diff options
| author | 2026-03-27 09:08:40 +0000 | |
|---|---|---|
| committer | 2026-03-27 09:08:40 +0000 | |
| commit | d7e90798170265b37ea5f980f94ca310cfda3180 (patch) | |
| tree | 89921ca5cb6dd5aaefa3c0ae72352381261cb1e6 /object/storer/loose/read_bytes.go | |
| parent | CONTRIBUTING: Fix submitting changes deadlines (diff) | |
| signature | No signature | |
object/store: Rename from object/storer
Diffstat (limited to 'object/storer/loose/read_bytes.go')
| -rw-r--r-- | object/storer/loose/read_bytes.go | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/object/storer/loose/read_bytes.go b/object/storer/loose/read_bytes.go deleted file mode 100644 index 0b6da81b..00000000 --- a/object/storer/loose/read_bytes.go +++ /dev/null @@ -1,49 +0,0 @@ -package loose - -import ( - objectid "codeberg.org/lindenii/furgit/object/id" - objecttype "codeberg.org/lindenii/furgit/object/type" -) - -// readBytesParsed reads, inflates, and parses a loose object in one pass. -// It returns the full raw payload and its parsed type and content. -func (store *Store) readBytesParsed(id objectid.ObjectID) ([]byte, objecttype.Type, []byte, error) { - file, err := store.openObject(id) - if err != nil { - return nil, objecttype.TypeInvalid, nil, err - } - - defer func() { _ = file.Close() }() - - raw, err := decodeAll(file) - if err != nil { - return nil, objecttype.TypeInvalid, nil, err - } - - ty, content, err := parseRaw(raw) - if err != nil { - return nil, objecttype.TypeInvalid, nil, err - } - - return raw, ty, content, nil -} - -// ReadBytesFull reads a full serialized object as "type size\0content". -func (store *Store) ReadBytesFull(id objectid.ObjectID) ([]byte, error) { - raw, _, _, err := store.readBytesParsed(id) - if err != nil { - return nil, err - } - - return raw, nil -} - -// ReadBytesContent reads an object's type and content bytes. -func (store *Store) ReadBytesContent(id objectid.ObjectID) (objecttype.Type, []byte, error) { - _, ty, content, err := store.readBytesParsed(id) - if err != nil { - return objecttype.TypeInvalid, nil, err - } - - return ty, content, nil -} |
