Add types.ImageSource and types.ImageDestination

Right now, only a declaration.

This will allow writing generalized push/pull between various storage
mechanisms, and reuse of the Docker Registry client code for the Docker
Registry embedded in OpenShift.
This commit is contained in:
Miloslav Trmač 2016-05-02 15:07:44 +02:00
parent aff6aa7c2c
commit a4aedae063

View File

@ -2,6 +2,7 @@ package types
import (
"fmt"
"io"
"time"
)
@ -23,6 +24,20 @@ type Repository interface {
Image(ref string) Image // ref == image name w/o registry part
}
// ImageSource is a service, possibly remote (= slow), to download components of a single image.
type ImageSource interface {
GetManifest() (manifest []byte, unverifiedCanonicalDigest string, err error)
GetLayer(digest string) (io.ReadCloser, error)
GetSignatures() ([][]byte, error)
}
// ImageDestination is a service, possibly remote (= slow), to store components of a single image.
type ImageDestination interface {
PutManifest([]byte) error
PutLayer(digest string, stream io.Reader) error
PutSignatures(signatures [][]byte) error
}
// Image is a Docker image in a repository.
type Image interface {
// ref to repository?