Documentation ¶
Index ¶
- Variables
- func CloseLogDB() error
- func DefaultHashFunc(data []byte) []byte
- func New(options ...Option) (trie.Trie, error)
- func NewLayerTwoLeafIterator(tr trie.TwoLayerTrie, layerOneKey []byte, l int) (trie.Iterator, error)
- func NewLeafIterator(tr trie.Trie) (trie.Iterator, error)
- func NewTwoLayerTrie(dbForTrie trie.KVStore, rootKey string) trie.TwoLayerTrie
- func OpenLogDB(dbPath string) error
- type HashFunc
- type LeafIterator
- type Option
- type SortedList
Constants ¶
This section is empty.
Variables ¶
var ErrNoData = errors.New("no data in hash node")
ErrNoData is an error when a hash node has no corresponding data
Functions ¶
func DefaultHashFunc ¶
DefaultHashFunc implements a default hash function
func NewLayerTwoLeafIterator ¶
func NewLayerTwoLeafIterator(tr trie.TwoLayerTrie, layerOneKey []byte, l int) (trie.Iterator, error)
NewLayerTwoLeafIterator returns a new leaf iterator
func NewLeafIterator ¶
NewLeafIterator returns a new leaf iterator
func NewTwoLayerTrie ¶
func NewTwoLayerTrie(dbForTrie trie.KVStore, rootKey string) trie.TwoLayerTrie
NewTwoLayerTrie creates a two layer trie
Types ¶
type LeafIterator ¶
type LeafIterator struct {
// contains filtered or unexported fields
}
LeafIterator defines an iterator to go through all the leaves under given node
type Option ¶
type Option func(*merklePatriciaTrie) error
Option sets parameters for SameKeyLenTrieContext construction parameter
func HashFuncOption ¶
HashFuncOption sets the hash func for the trie
func KVStoreOption ¶
KVStoreOption sets the kvStore for the trie
func KeyLengthOption ¶
KeyLengthOption sets the length of the keys saved in trie
func RootHashOption ¶
RootHashOption sets the root hash for the trie
type SortedList ¶
type SortedList struct {
// contains filtered or unexported fields
}
SortedList is a data structure where elements are in ascending order
func NewSortedList ¶
func NewSortedList(children map[byte]node) *SortedList
NewSortedList create SortedList from keys in the children map
func (*SortedList) Delete ¶
func (sl *SortedList) Delete(key uint8)
Delete deletes key in the sortedlist
func (*SortedList) Insert ¶
func (sl *SortedList) Insert(key uint8)
Insert insert key into sortedlist