OSDN Git Service

new repo
[bytom/vapor.git] / vendor / github.com / tendermint / tmlibs / merkle / types.go
1 package merkle
2
3 type Tree interface {
4         Size() (size int)
5         Height() (height int8)
6         Has(key []byte) (has bool)
7         Proof(key []byte) (value []byte, proof []byte, exists bool) // TODO make it return an index
8         Get(key []byte) (index int, value []byte, exists bool)
9         GetByIndex(index int) (key []byte, value []byte)
10         Set(key []byte, value []byte) (updated bool)
11         Remove(key []byte) (value []byte, removed bool)
12         HashWithCount() (hash []byte, count int)
13         Hash() (hash []byte)
14         Save() (hash []byte)
15         Load(hash []byte)
16         Copy() Tree
17         Iterate(func(key []byte, value []byte) (stop bool)) (stopped bool)
18         IterateRange(start []byte, end []byte, ascending bool, fx func(key []byte, value []byte) (stop bool)) (stopped bool)
19 }
20
21 type Hashable interface {
22         Hash() []byte
23 }