Documentation ¶
Index ¶
- Variables
- 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
- 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 ¶ added in v1.8.0
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 ¶ added in v1.7.1
type SortedList struct {
// contains filtered or unexported fields
}
SortedList is a data structure where elements are in ascending order
func NewSortedList ¶ added in v1.7.1
func NewSortedList(children map[byte]node) *SortedList
NewSortedList create SortedList from keys in the children map
func (*SortedList) Delete ¶ added in v1.7.1
func (sl *SortedList) Delete(key uint8)
Delete deletes key in the sortedlist
func (*SortedList) Insert ¶ added in v1.7.1
func (sl *SortedList) Insert(key uint8)
Insert insert key into sortedlist
func (*SortedList) List ¶ added in v1.7.1
func (sl *SortedList) List() []uint8
List returns sorted indices