diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2016-08-15 23:09:33 +0200 |
---|---|---|
committer | Máximo Cuadros <mcuadros@gmail.com> | 2016-08-15 23:09:33 +0200 |
commit | 6b9a59be60de5b66aee14e9160ace80734008eca (patch) | |
tree | c302776360b0fd4f774f67f177870fda478b4258 /core/storage.go | |
parent | ed2e3b299e03e4bfd4c37bf5232e9fde05c0600d (diff) | |
download | go-git-6b9a59be60de5b66aee14e9160ace80734008eca.tar.gz |
core: *Iter.ForEach method
Diffstat (limited to 'core/storage.go')
-rw-r--r-- | core/storage.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/core/storage.go b/core/storage.go index cb8f45d..6403f5f 100644 --- a/core/storage.go +++ b/core/storage.go @@ -1,5 +1,10 @@ package core +import "errors" + +//ErrStop is used to stop a ForEach function in an Iter +var ErrStop = errors.New("stop iter") + // Storage storage of objects and references type Storage interface { ObjectStorage() ObjectStorage @@ -17,6 +22,7 @@ type ObjectStorage interface { // ObjectIter is a generic closable interface for iterating over objects. type ObjectIter interface { Next() (Object, error) + ForEach(func(Object) error) error Close() } @@ -30,5 +36,6 @@ type ReferenceStorage interface { // ReferenceIter is a generic closable interface for iterating over references type ReferenceIter interface { Next() (*Reference, error) + ForEach(func(*Reference) error) error Close() } |