aboutsummaryrefslogtreecommitdiffstats
path: root/storage/memory/storage.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2017-01-28 16:26:14 +0100
committerMáximo Cuadros <mcuadros@gmail.com>2017-01-28 16:26:14 +0100
commit9a9f2b1f63a98fad67a3190ef813428b68dfdd8c (patch)
treec7266ab8a010d551670d9f6356294c09ffa9f7fb /storage/memory/storage.go
parent24c1878260351d9f9f6c575cbeeb5878104d6a0e (diff)
downloadgo-git-9a9f2b1f63a98fad67a3190ef813428b68dfdd8c.tar.gz
storage: IndexStorer implementation
Diffstat (limited to 'storage/memory/storage.go')
-rw-r--r--storage/memory/storage.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/storage/memory/storage.go b/storage/memory/storage.go
index ecf2efa..444f289 100644
--- a/storage/memory/storage.go
+++ b/storage/memory/storage.go
@@ -6,6 +6,7 @@ import (
"gopkg.in/src-d/go-git.v4/config"
"gopkg.in/src-d/go-git.v4/plumbing"
+ "gopkg.in/src-d/go-git.v4/plumbing/format/index"
"gopkg.in/src-d/go-git.v4/plumbing/storer"
)
@@ -19,6 +20,7 @@ type Storage struct {
ConfigStorage
ObjectStorage
ShallowStorage
+ IndexStorage
ReferenceStorage
}
@@ -59,6 +61,23 @@ func (c *ConfigStorage) Config() (*config.Config, error) {
return c.config, nil
}
+type IndexStorage struct {
+ index *index.Index
+}
+
+func (c *IndexStorage) SetIndex(idx *index.Index) error {
+ c.index = idx
+ return nil
+}
+
+func (c *IndexStorage) Index() (*index.Index, error) {
+ if c.index == nil {
+ c.index = &index.Index{}
+ }
+
+ return c.index, nil
+}
+
type ObjectStorage struct {
Objects map[plumbing.Hash]plumbing.EncodedObject
Commits map[plumbing.Hash]plumbing.EncodedObject