IAVLTree supports Codec.

This commit is contained in:
Jae Kwon
2014-10-11 00:52:29 -07:00
parent f9d35a5907
commit cd4ef5d01f
7 changed files with 440 additions and 532 deletions

View File

@ -1,29 +1,18 @@
package merkle
import (
"fmt"
)
type DB interface {
Get([]byte) []byte
Set([]byte, []byte)
}
type Tree interface {
Size() uint64
Height() uint8
Has(key []byte) bool
Get(key []byte) []byte
Set(key []byte, value []byte) bool
Remove(key []byte) ([]byte, error)
HashWithCount() ([]byte, uint64)
Hash() []byte
Save() []byte
Copy() Tree
}
func NotFound(key []byte) error {
return fmt.Errorf("Key was not found.")
Size() (size uint64)
Height() (height uint8)
Has(key interface{}) (has bool)
Get(key interface{}) (index uint64, value interface{})
GetByIndex(index uint64) (key interface{}, value interface{})
Set(key interface{}, value interface{}) (updated bool)
Remove(key interface{}) (value interface{}, removed bool)
HashWithCount() (hash []byte, count uint64)
Hash() (hash []byte)
Save() (hash []byte)
Checkpoint() (checkpoint interface{})
Restore(checkpoint interface{})
}
type Hashable interface {