From a4aedae063e4b07aa85e196d8c4488faa848e787 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20Trma=C4=8D?= Date: Mon, 2 May 2016 15:07:44 +0200 Subject: [PATCH] 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. --- types/types.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/types/types.go b/types/types.go index 7586dcd6..1575ac8b 100644 --- a/types/types.go +++ b/types/types.go @@ -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?