diff options
| author | 2026-03-22 17:27:37 +0000 | |
|---|---|---|
| committer | 2026-03-22 17:27:37 +0000 | |
| commit | 8f577284f47f699855dcb3ceda21aa9d8be77c2f (patch) | |
| tree | 36f8d47a1584bd80e9e114d5c68ad5ec6c333b88 /objectstore/objectstore.go | |
| parent | internal/testgit: why not make it more annoying to use ambient authority (diff) | |
| signature | No signature | |
objectstore{,/loose}: Document contracts more clearly
Diffstat (limited to 'objectstore/objectstore.go')
| -rw-r--r-- | objectstore/objectstore.go | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/objectstore/objectstore.go b/objectstore/objectstore.go index 2592c1b1..f152a7f0 100644 --- a/objectstore/objectstore.go +++ b/objectstore/objectstore.go @@ -25,27 +25,47 @@ type Store interface { // In a valid repository, hashing this payload with the same algorithm yields // the requested object ID. Readers should treat this as a repository // invariant and should not re-verify it on every read. + // + // Any read-time integrity verification beyond producing this payload is + // implementation-defined. ReadBytesFull(id objectid.ObjectID) ([]byte, error) // ReadBytesContent reads an object's type and content bytes. + // + // Any read-time integrity verification beyond producing this payload is + // implementation-defined. ReadBytesContent(id objectid.ObjectID) (objecttype.Type, []byte, error) // ReadReaderFull reads a full serialized object stream as "type size\0content". + // // Caller must close the returned reader. + // + // Any read-time integrity verification performed while producing the stream + // is implementation-defined. ReadReaderFull(id objectid.ObjectID) (io.ReadCloser, error) // ReadReaderContent reads an object's type, declared content length, // and content stream. + // // Caller must close the returned reader. + // + // Any read-time integrity verification performed while producing the stream + // is implementation-defined. ReadReaderContent(id objectid.ObjectID) (objecttype.Type, int64, io.ReadCloser, error) // ReadSize reads an object's declared content length. // // This is equivalent to ReadHeader(...).size and may be cheaper than // ReadHeader when callers do not need object type. + // + // Any read-time integrity verification performed to produce the size is + // implementation-defined. ReadSize(id objectid.ObjectID) (int64, error) // ReadHeader reads an object's type and declared content length. + // + // Any read-time integrity verification performed to produce the header is + // implementation-defined. ReadHeader(id objectid.ObjectID) (objecttype.Type, int64, error) // Refresh updates any backend-local discovery/cache view of on-disk objects. @@ -54,6 +74,9 @@ type Store interface { Refresh() error // Close releases resources associated with the backend. + // + // Repeated calls to Close are undefined behavior unless the implementation + // explicitly documents otherwise. Close() error } |
