aboutsummaryrefslogtreecommitdiff
path: root/objectstore/packed/new.go
diff options
context:
space:
mode:
Diffstat (limited to 'objectstore/packed/new.go')
-rw-r--r--objectstore/packed/new.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/objectstore/packed/new.go b/objectstore/packed/new.go
new file mode 100644
index 00000000..407bc1d0
--- /dev/null
+++ b/objectstore/packed/new.go
@@ -0,0 +1,24 @@
+package packed
+
+import (
+ "os"
+
+ "codeberg.org/lindenii/furgit/objectid"
+)
+
+// New creates a packed-object store rooted at an objects/pack directory.
+func New(root *os.Root, algo objectid.Algorithm) (*Store, error) {
+ if algo.Size() == 0 {
+ return nil, objectid.ErrInvalidAlgorithm
+ }
+
+ return &Store{
+ root: root,
+ algo: algo,
+ candidateByPack: make(map[string]packCandidate),
+ candidateNodeByPack: make(map[string]*packCandidateNode),
+ idxByPack: make(map[string]*idxFile),
+ packs: make(map[string]*packFile),
+ deltaCache: newDeltaCache(defaultDeltaCacheMaxBytes),
+ }, nil
+}