diff options
author | Taru Karttunen <taruti@taruti.net> | 2017-11-01 21:06:37 +0200 |
---|---|---|
committer | Jeremy Stribling <strib@alum.mit.edu> | 2017-11-29 10:40:46 -0800 |
commit | ac1914eac3c20efa63de8809229994364ad9639b (patch) | |
tree | 4595bfceec10aea603517e5dc7f493b93e068d30 /storage/memory | |
parent | a6202cacd12aa5ee20c54aff799b0e91330526c5 (diff) | |
download | go-git-ac1914eac3c20efa63de8809229994364ad9639b.tar.gz |
First pass of prune design
Diffstat (limited to 'storage/memory')
-rw-r--r-- | storage/memory/storage.go | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/storage/memory/storage.go b/storage/memory/storage.go index 3d4e84a..bfcad34 100644 --- a/storage/memory/storage.go +++ b/storage/memory/storage.go @@ -3,6 +3,7 @@ package memory import ( "fmt" + "time" "gopkg.in/src-d/go-git.v4/config" "gopkg.in/src-d/go-git.v4/plumbing" @@ -156,6 +157,28 @@ func (o *ObjectStorage) Begin() storer.Transaction { } } +func (o *ObjectStorage) ForEachObjectHash(fun func(plumbing.Hash) error) error { + for h, _ := range o.Objects { + err := fun(h) + if err != nil { + if err == storer.ErrStop { + return nil + } + return err + } + } + return nil +} + +var errNotSupported = fmt.Errorf("Not supported") + +func (s *ObjectStorage) LooseObjectTime(hash plumbing.Hash) (time.Time, error) { + return time.Time{}, errNotSupported +} +func (s *ObjectStorage) DeleteLooseObject(plumbing.Hash) error { + return errNotSupported +} + type TxObjectStorage struct { Storage *ObjectStorage Objects map[plumbing.Hash]plumbing.EncodedObject |