aboutsummaryrefslogtreecommitdiffstats
path: root/core/storage.go
diff options
context:
space:
mode:
Diffstat (limited to 'core/storage.go')
-rw-r--r--core/storage.go34
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()
+}