aboutsummaryrefslogtreecommitdiffstats
path: root/storage/filesystem
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2016-09-05 07:59:20 +0200
committerMáximo Cuadros <mcuadros@gmail.com>2016-09-05 07:59:20 +0200
commit65427f64599e9383ab926aed75fc02f2db32022d (patch)
tree5c81c00bc9dcfb54e0c6d0038ab2cbd8cddde389 /storage/filesystem
parent440cfd96cf88ffc9d04bbd32ec8a3b1afb42144c (diff)
downloadgo-git-65427f64599e9383ab926aed75fc02f2db32022d.tar.gz
core: ObjectStorage.Begin and TxObjectStorage
Diffstat (limited to 'storage/filesystem')
-rw-r--r--storage/filesystem/object.go17
-rw-r--r--storage/filesystem/object_test.go8
2 files changed, 21 insertions, 4 deletions
diff --git a/storage/filesystem/object.go b/storage/filesystem/object.go
index 3888fd8..0696c70 100644
--- a/storage/filesystem/object.go
+++ b/storage/filesystem/object.go
@@ -217,3 +217,20 @@ func buildIndexFromIdxfile(fs fs.FS, path string) (index.Index, error) {
return index.NewFromIdx(f)
}
+func (o *ObjectStorage) Begin() core.TxObjectStorage {
+ return &TxObjectStorage{}
+}
+
+type TxObjectStorage struct{}
+
+func (tx *TxObjectStorage) Set(obj core.Object) (core.Hash, error) {
+ return core.ZeroHash, fmt.Errorf("not implemented yet")
+}
+
+func (tx *TxObjectStorage) Commit() error {
+ return fmt.Errorf("not implemented yet")
+}
+
+func (tx *TxObjectStorage) Rollback() error {
+ return fmt.Errorf("not implemented yet")
+}
diff --git a/storage/filesystem/object_test.go b/storage/filesystem/object_test.go
index 361ae32..5752f79 100644
--- a/storage/filesystem/object_test.go
+++ b/storage/filesystem/object_test.go
@@ -124,9 +124,9 @@ func memStorageFromGitDir(fs fs.FS, path string) (core.ObjectStorage, error) {
sto := memory.NewStorage()
r := packfile.NewStream(f)
- d := packfile.NewDecoder(r)
+ d := packfile.NewDecoder(r, sto.ObjectStorage())
- err = d.Decode(sto.ObjectStorage())
+ err = d.Decode()
if err != nil {
return nil, err
}
@@ -267,8 +267,8 @@ func memStorageFromDirPath(fs fs.FS, path string) (core.ObjectStorage, error) {
}
r := packfile.NewStream(f)
- d := packfile.NewDecoder(r)
- err = d.Decode(sto.ObjectStorage())
+ d := packfile.NewDecoder(r, sto.ObjectStorage())
+ err = d.Decode()
if err != nil {
return nil, err
}