mirror of
https://github.com/dolthub/dolt.git
synced 2026-02-25 10:19:24 -06:00
/go/store/blobstore: update comments
This commit is contained in:
@@ -33,7 +33,12 @@ type Blobstore interface {
|
||||
// Get returns a byte range of from the blob keyed by |key|, and the latest store version.
|
||||
Get(ctx context.Context, key string, br BlobRange) (rc io.ReadCloser, size uint64, version string, err error)
|
||||
|
||||
// Put creates a new blob from |reader| keyed by |key|, it returns the latest store version.
|
||||
// Put stores a blob from |reader| keyed by |key|, returning the latest store version.
|
||||
//
|
||||
// If |key| already exists, behavior is implementation-defined: some Blobstore
|
||||
// implementations overwrite, while others may treat Put as idempotent and fast-succeed
|
||||
// without consuming |reader|. Callers that require an explicit check-and-set should use
|
||||
// CheckAndPut.
|
||||
Put(ctx context.Context, key string, totalSize int64, reader io.Reader) (version string, err error)
|
||||
|
||||
// CheckAndPut updates the blob keyed by |key| using a check-and-set on |expectedVersion|.
|
||||
|
||||
@@ -425,8 +425,11 @@ func (gbs *GitBlobstore) Put(ctx context.Context, key string, totalSize int64, r
|
||||
// Many NBS/table-file writes are content-addressed: if the key already exists, callers
|
||||
// assume it refers to the same bytes and treat the operation as idempotent.
|
||||
//
|
||||
// The manifest is the main exception (it is mutable and updated via CheckAndPut), so
|
||||
// we only apply this fast-path for non-manifest keys.
|
||||
// GitBlobstore enforces that assumption by fast-succeeding when a non-manifest key
|
||||
// already exists: it returns the existing per-key version and does not overwrite the
|
||||
// key (and does not consume |reader|).
|
||||
//
|
||||
// The manifest is the main exception (it is mutable and updated via CheckAndPut).
|
||||
if ver, ok, err := gbs.tryFastSucceedPutIfKeyExists(ctx, key); err != nil {
|
||||
return "", err
|
||||
} else if ok {
|
||||
|
||||
Reference in New Issue
Block a user