aboutsummaryrefslogtreecommitdiff
path: root/object/store/memory/write_bytes.go
diff options
context:
space:
mode:
authorGravatar Runxi Yu2026-04-02 06:23:30 +0000
committerGravatar Runxi Yu2026-04-02 06:28:39 +0000
commita041d523de389b65b98a5373a8034041db2a8d83 (patch)
tree7b423dc735f463be616045f2c3c2095a7737aca7 /object/store/memory/write_bytes.go
parentresearch: Add dynamic pack resources (diff)
signatureNo signature
*: Remove
Diffstat (limited to 'object/store/memory/write_bytes.go')
-rw-r--r--object/store/memory/write_bytes.go35
1 files changed, 0 insertions, 35 deletions
diff --git a/object/store/memory/write_bytes.go b/object/store/memory/write_bytes.go
deleted file mode 100644
index 241169d9..00000000
--- a/object/store/memory/write_bytes.go
+++ /dev/null
@@ -1,35 +0,0 @@
-package memory
-
-import (
- "bytes"
-
- objectheader "codeberg.org/lindenii/furgit/object/header"
- objectid "codeberg.org/lindenii/furgit/object/id"
- objecttype "codeberg.org/lindenii/furgit/object/type"
-)
-
-// WriteBytesContent writes one typed object content byte slice.
-func (store *Store) WriteBytesContent(ty objecttype.Type, content []byte) (objectid.ObjectID, error) {
- id := store.algo.Sum(buildRawObject(ty, content))
- store.objects[id] = storedObject{ty: ty, content: append([]byte(nil), content...)}
-
- return id, nil
-}
-
-// WriteBytesFull writes one full serialized object byte slice as "type size\0content".
-func (store *Store) WriteBytesFull(raw []byte) (objectid.ObjectID, error) {
- return store.WriteReaderFull(bytes.NewReader(raw))
-}
-
-func buildRawObject(ty objecttype.Type, body []byte) []byte {
- header, ok := objectheader.Encode(ty, int64(len(body)))
- if !ok {
- panic("failed to encode object header")
- }
-
- raw := make([]byte, len(header)+len(body))
- copy(raw, header)
- copy(raw[len(header):], body)
-
- return raw
-}