diff options
| author | 2026-03-28 15:28:06 +0000 | |
|---|---|---|
| committer | 2026-03-28 15:28:06 +0000 | |
| commit | 1c40580341ce397a06002fd37d9467617e03dc9c (patch) | |
| tree | 3e2e27176df7f0869c528b4ded24a910c84592d8 /object | |
| parent | furgit: MT-Safe does not apply for Close (diff) | |
| signature | No signature | |
object/store: Document store contract
Diffstat (limited to 'object')
| -rw-r--r-- | object/store/reading.go | 35 |
1 files changed, 10 insertions, 25 deletions
diff --git a/object/store/reading.go b/object/store/reading.go index 017c3e94..0c6eff18 100644 --- a/object/store/reading.go +++ b/object/store/reading.go @@ -9,8 +9,10 @@ import ( // ReadingStore reads Git objects by object ID. // -// Unless an implementation explicitly documents otherwise, values returned by -// ReadingStore methods are only valid until the store is closed. +// Methods may perform implementation-defined integrity verification beyond +// successfully producing their documented result. +// +// Labels: MT-Safe. type ReadingStore interface { // ReadBytesFull reads a full serialized object as "type size\0content". // @@ -18,58 +20,41 @@ type ReadingStore interface { // 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. + // Labels: Life-Parent. 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. + // Labels: Life-Parent. 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. - // The returned reader is only valid until the store is closed. - // - // Any read-time integrity verification performed while producing the stream - // is implementation-defined. + // Labels: Life-Parent, Close-Caller. 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. - // The returned reader is only valid until the store is closed. - // - // Any read-time integrity verification performed while producing the stream - // is implementation-defined. + // Labels: Life-Parent, Close-Caller. 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. // - // Backends without dynamic discovery should return nil. + // Backends without dynamic discovery should do nothing and return nil. Refresh() error // Close releases resources associated with the backend. // - // Repeated calls to Close are undefined behavior unless the implementation - // explicitly documents otherwise. + // Labels: Close-UB. Close() error } |
