diff options
| author | 2026-03-25 14:30:31 +0000 | |
|---|---|---|
| committer | 2026-03-25 14:30:31 +0000 | |
| commit | bfa0a3f5f18b752a6ebd3d5b37411c6871f7bb17 (patch) | |
| tree | 8ee2479273e2b34d284c30703c2be48efe197556 /objectstore/chain/bytes.go | |
| parent | *: Resort import order (diff) | |
| signature | No signature | |
*: objectstore -> object/store
Diffstat (limited to 'objectstore/chain/bytes.go')
| -rw-r--r-- | objectstore/chain/bytes.go | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/objectstore/chain/bytes.go b/objectstore/chain/bytes.go deleted file mode 100644 index ac537e99..00000000 --- a/objectstore/chain/bytes.go +++ /dev/null @@ -1,46 +0,0 @@ -package chain - -import ( - "errors" - "fmt" - - objectid "codeberg.org/lindenii/furgit/object/id" - objecttype "codeberg.org/lindenii/furgit/object/type" - "codeberg.org/lindenii/furgit/objectstore" -) - -// ReadBytesFull reads a full serialized object from the first backend that has it. -func (chain *Chain) ReadBytesFull(id objectid.ObjectID) ([]byte, error) { - for i, backend := range chain.backends { - full, err := backend.ReadBytesFull(id) - if err == nil { - return full, nil - } - - if errors.Is(err, objectstore.ErrObjectNotFound) { - continue - } - - return nil, fmt.Errorf("objectstore: backend %d read bytes full: %w", i, err) - } - - return nil, objectstore.ErrObjectNotFound -} - -// ReadBytesContent reads an object's type and content bytes from the first backend that has it. -func (chain *Chain) ReadBytesContent(id objectid.ObjectID) (objecttype.Type, []byte, error) { - for i, backend := range chain.backends { - ty, content, err := backend.ReadBytesContent(id) - if err == nil { - return ty, content, nil - } - - if errors.Is(err, objectstore.ErrObjectNotFound) { - continue - } - - return objecttype.TypeInvalid, nil, fmt.Errorf("objectstore: backend %d read bytes content: %w", i, err) - } - - return objecttype.TypeInvalid, nil, objectstore.ErrObjectNotFound -} |
