aboutsummaryrefslogtreecommitdiffstats
path: root/storage
diff options
context:
space:
mode:
Diffstat (limited to 'storage')
-rw-r--r--storage/filesystem/storage.go15
-rw-r--r--storage/memory/storage.go10
2 files changed, 25 insertions, 0 deletions
diff --git a/storage/filesystem/storage.go b/storage/filesystem/storage.go
index 622bb4a..6af906d 100644
--- a/storage/filesystem/storage.go
+++ b/storage/filesystem/storage.go
@@ -2,6 +2,9 @@
package filesystem
import (
+ "fmt"
+
+ "gopkg.in/src-d/go-git.v4/plumbing/format/index"
"gopkg.in/src-d/go-git.v4/storage/filesystem/dotgit"
"gopkg.in/src-d/go-billy.v4"
@@ -51,3 +54,15 @@ func (s *Storage) Filesystem() billy.Filesystem {
func (s *Storage) Init() error {
return s.dir.Initialize()
}
+
+type IndexStorage struct {
+ dir *dotgit.DotGit
+}
+
+func (IndexStorage) SetIndex(*index.Index) error {
+ return fmt.Errorf("not implemented")
+}
+
+func (IndexStorage) Index() (*index.Index, error) {
+ return nil, fmt.Errorf("not implemented")
+}
diff --git a/storage/memory/storage.go b/storage/memory/storage.go
index 2e32509..a950a62 100644
--- a/storage/memory/storage.go
+++ b/storage/memory/storage.go
@@ -91,6 +91,16 @@ type ObjectStorage struct {
Tags map[plumbing.Hash]plumbing.EncodedObject
}
+func NewObjectStorage() *ObjectStorage {
+ return &ObjectStorage{
+ Objects: make(map[plumbing.Hash]plumbing.EncodedObject),
+ Commits: make(map[plumbing.Hash]plumbing.EncodedObject),
+ Trees: make(map[plumbing.Hash]plumbing.EncodedObject),
+ Blobs: make(map[plumbing.Hash]plumbing.EncodedObject),
+ Tags: make(map[plumbing.Hash]plumbing.EncodedObject),
+ }
+}
+
func (o *ObjectStorage) NewEncodedObject() plumbing.EncodedObject {
return &plumbing.MemoryObject{}
}