From 92cedc3f7245352b7ce89d47582c7acaac6230c9 Mon Sep 17 00:00:00 2001 From: Brian Gitonga Marete Date: Thu, 19 Dec 2013 16:02:20 +0300 Subject: [PATCH] pkg/blobserver: Introduce a BlobStreaming interface. This commit introduces the basic API required to implement high-throughput blob streaming functionality within the various blob storage engines. Change-Id: Ie170d11b229196617f96b298f864ad12af62c363 --- pkg/blobserver/interface.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/pkg/blobserver/interface.go b/pkg/blobserver/interface.go index 66f6209ac..662c82460 100644 --- a/pkg/blobserver/interface.go +++ b/pkg/blobserver/interface.go @@ -99,6 +99,22 @@ type BlobEnumerator interface { limit int) error } +type BlobStreamer interface { + // StreamBlobs sends blobs to dest in unspecified order. It is + // expected that a blobstorage implementing BlobStreamer will + // send blobs to dest in the most efficient order + // possible. StreamBlobs will stop sending blobs to dest and + // return an opaque continuation token (in the string return + // parameter) when the total size of the blobs it has sent + // equals or exceeds limit. A succeeding call to StreamBlobs + // should pass the string returned from the previous call in + // contToken, or an empty string if the caller wishes to + // receive blobs from "the start". StreamBlobs must + // unconditionally close dest before returning, and it must + // return if ctx.Done() becomes readable. + StreamBlobs(ctx *context.Context, dest chan<- blob.Blob, contToken string, limitBytes int64) (nextContinueToken string, err error) +} + // Cache is the minimal interface expected of a blob cache. type Cache interface { blob.SeekFetcher