diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2016-08-12 19:11:27 +0200 |
---|---|---|
committer | Máximo Cuadros <mcuadros@gmail.com> | 2016-08-12 19:11:56 +0200 |
commit | ae999ede139f5fa5601ffb7c55979608b112d274 (patch) | |
tree | bfa028690c5361df3bf328f7d777a3c6e4bf34e7 /core | |
parent | 5a9ed6e35d7a807de80cfea04e1bd31ebc718563 (diff) | |
download | go-git-ae999ede139f5fa5601ffb7c55979608b112d274.tar.gz |
storage: Storage entity support, and DotGit support for References
Diffstat (limited to 'core')
-rw-r--r-- | core/storage.go | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/core/storage.go b/core/storage.go new file mode 100644 index 0000000..70a47e6 --- /dev/null +++ b/core/storage.go @@ -0,0 +1,34 @@ +package core + +// Storage storage of objects and references +type Storage interface { + ObjectStorage() (ObjectStorage, error) + ReferenceStorage() (ReferenceStorage, error) +} + +// ObjectStorage generic storage of objects +type ObjectStorage interface { + NewObject() Object + Set(Object) (Hash, error) + Get(Hash) (Object, error) + Iter(ObjectType) (ObjectIter, error) +} + +// ObjectIter is a generic closable interface for iterating over objects. +type ObjectIter interface { + Next() (Object, error) + Close() +} + +// ReferenceStorage generic storage of references +type ReferenceStorage interface { + Set(*Reference) error + Get(ReferenceName) (*Reference, error) + Iter() (ReferenceIter, error) +} + +// ReferenceIter is a generic closable interface for iterating over references +type ReferenceIter interface { + Next() (*Reference, error) + Close() +} |