aboutsummaryrefslogtreecommitdiff
path: root/object/store/packed/read_bytes.go
diff options
context:
space:
mode:
authorGravatar Runxi Yu2026-03-30 13:53:54 +0000
committerGravatar Runxi Yu2026-03-30 13:54:27 +0000
commit238b2caf83dde3c4395109c51b8c9affa6e11890 (patch)
treee9d946bea08515c2d86954ea617a237710f9f2bf /object/store/packed/read_bytes.go
parentobject/store/memory: Remove AddObject, fix lints (diff)
signatureNo signature
object/store/packed: Start the internal/reading split
Diffstat (limited to 'object/store/packed/read_bytes.go')
-rw-r--r--object/store/packed/read_bytes.go46
1 files changed, 0 insertions, 46 deletions
diff --git a/object/store/packed/read_bytes.go b/object/store/packed/read_bytes.go
deleted file mode 100644
index 222d9a05..00000000
--- a/object/store/packed/read_bytes.go
+++ /dev/null
@@ -1,46 +0,0 @@
-package packed
-
-import (
- "fmt"
-
- objectheader "codeberg.org/lindenii/furgit/object/header"
- objectid "codeberg.org/lindenii/furgit/object/id"
- objecttype "codeberg.org/lindenii/furgit/object/type"
-)
-
-// ReadBytesContent reads an object's type and content bytes.
-//
-// It fully resolves the requested object bytes. For base pack entries, this
-// includes verifying that the zlib stream inflates to exactly the declared
-// object size and verifying the Adler-32 trailer.
-func (store *Store) ReadBytesContent(id objectid.ObjectID) (objecttype.Type, []byte, error) {
- loc, err := store.lookup(id)
- if err != nil {
- return objecttype.TypeInvalid, nil, err
- }
-
- return store.deltaResolveContent(loc)
-}
-
-// ReadBytesFull reads a full serialized object as "type size\0content".
-//
-// Like ReadBytesContent, it fully resolves the requested object bytes. For
-// base pack entries, this includes verifying that the zlib stream inflates to
-// exactly the declared object size and verifying the Adler-32 trailer.
-func (store *Store) ReadBytesFull(id objectid.ObjectID) ([]byte, error) {
- ty, content, err := store.ReadBytesContent(id)
- if err != nil {
- return nil, err
- }
-
- header, ok := objectheader.Encode(ty, int64(len(content)))
- if !ok {
- return nil, fmt.Errorf("objectstore/packed: failed to encode object header for type %d", ty)
- }
-
- out := make([]byte, len(header)+len(content))
- copy(out, header)
- copy(out[len(header):], content)
-
- return out, nil
-}