aboutsummaryrefslogtreecommitdiffstats
path: root/core/storage.go
blob: 70a47e6cd9a05bc1f2aa7c3f0b42a01f04643f69 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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()
}