1package module23import (4 "context"5 "errors"6 "io"7)89type Blob interface {10 Sync() error11 io.Writer12 io.Closer13}1415var ErrNoSuchBlob = errors.New("blob_store: no such object")1617const UnknownBlobSize int64 = -11819// BlobStore is the interface used by modules providing large binary object20// storage.21type BlobStore interface {22 // Create creates a new blob for writing.23 //24 // Sync will be called on the returned Blob object after -all- data has25 // been successfully written.26 //27 // Close without Sync can be assumed to happen due to an unrelated error28 // and stored data can be discarded.29 //30 // blobSize indicates the exact amount of bytes that will be written31 // If -1 is passed - it is unknown and implementation will not make32 // any assumptions about the blob size. Error can be returned by any33 // Blob method if more than than blobSize bytes get written.34 //35 // Passed context will cover the entire blob write operation.36 Create(ctx context.Context, key string, blobSize int64) (Blob, error)3738 // Open returns the reader for the object specified by39 // passed key.40 //41 // If no such object exists - ErrNoSuchBlob is returned.42 Open(ctx context.Context, key string) (io.ReadCloser, error)4344 // Delete removes a set of keys from store. Non-existent keys are ignored.45 Delete(ctx context.Context, keys []string) error46}