tendermint/merkle/types.go

32 lines
471 B
Go
Raw Normal View History

package merkle
import (
2014-07-01 14:50:24 -07:00
"fmt"
)
2014-10-05 21:21:34 -07:00
type DB interface {
2014-07-01 14:50:24 -07:00
Get([]byte) []byte
2014-07-19 15:19:07 -07:00
Set([]byte, []byte)
2014-05-23 17:49:28 -07:00
}
2014-05-23 23:11:22 -07:00
type Tree interface {
2014-07-01 14:50:24 -07:00
Size() uint64
Height() uint8
Has(key []byte) bool
Get(key []byte) []byte
2014-10-06 13:55:56 -07:00
Set(key []byte, value []byte) bool
Remove(key []byte) ([]byte, error)
HashWithCount() ([]byte, uint64)
Hash() []byte
2014-10-06 13:55:56 -07:00
Save() []byte
2014-07-01 14:50:24 -07:00
Copy() Tree
2014-05-23 23:11:22 -07:00
}
func NotFound(key []byte) error {
2014-07-01 14:50:24 -07:00
return fmt.Errorf("Key was not found.")
}
2014-09-14 15:37:32 -07:00
type Hashable interface {
Hash() []byte
}