Documentation ¶
Index ¶
- type IAVLNode
- type IAVLProof
- type IAVLProofInnerNode
- type IAVLProofLeafNode
- type IAVLTree
- func (t *IAVLTree) BatchSet(key []byte, value []byte)
- func (t *IAVLTree) ConstructProof(key []byte) (value []byte, proof *IAVLProof)
- func (t *IAVLTree) Copy() merkle.Tree
- func (t *IAVLTree) Get(key []byte) (index int, value []byte, exists bool)
- func (t *IAVLTree) GetByIndex(index int) (key []byte, value []byte)
- func (t *IAVLTree) Has(key []byte) bool
- func (t *IAVLTree) Hash() []byte
- func (t *IAVLTree) HashWithCount() ([]byte, int)
- func (t *IAVLTree) Height() int8
- func (t *IAVLTree) Iterate(fn func(key []byte, value []byte) bool) (stopped bool)
- func (t *IAVLTree) IterateRange(start, end []byte, ascending bool, fn func(key []byte, value []byte) bool) (stopped bool)
- func (t *IAVLTree) Load(hash []byte)
- func (t *IAVLTree) Proof(key []byte) (value []byte, proofBytes []byte, exists bool)
- func (t *IAVLTree) Remove(key []byte) (value []byte, removed bool)
- func (t *IAVLTree) Save() []byte
- func (t *IAVLTree) Set(key []byte, value []byte) (updated bool)
- func (t *IAVLTree) Size() int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IAVLNode ¶
type IAVLNode struct {
// contains filtered or unexported fields
}
func MakeIAVLNode ¶
NOTE: The hash is not saved or set. The caller should set the hash afterwards. (Presumably the caller already has the hash)
func NewIAVLNode ¶
type IAVLProof ¶
type IAVLProof struct { LeafHash []byte InnerNodes []IAVLProofInnerNode RootHash []byte }
type IAVLProofInnerNode ¶
func (IAVLProofInnerNode) Hash ¶
func (branch IAVLProofInnerNode) Hash(childHash []byte) []byte
type IAVLProofLeafNode ¶
func (IAVLProofLeafNode) Hash ¶
func (leaf IAVLProofLeafNode) Hash() []byte
type IAVLTree ¶
type IAVLTree struct {
// contains filtered or unexported fields
}
Immutable AVL Tree (wraps the Node root) This tree is not goroutine safe.
func NewIAVLTree ¶
NewIAVLTree creates both im-memory and persistent instances
func (*IAVLTree) ConstructProof ¶
Returns nil, nil if key is not in tree.
func (*IAVLTree) Copy ¶
The returned tree and the original tree are goroutine independent. That is, they can each run in their own goroutine. However, upon Save(), any other trees that share a db will become outdated, as some nodes will become orphaned. Note that Save() clears leftNode and rightNode. Otherwise, two copies would not be goroutine independent.
func (*IAVLTree) HashWithCount ¶
func (*IAVLTree) IterateRange ¶
func (t *IAVLTree) IterateRange(start, end []byte, ascending bool, fn func(key []byte, value []byte) bool) (stopped bool)
IterateRange makes a callback for all nodes with key between start and end inclusive If either are nil, then it is open on that side (nil, nil is the same as Iterate)
func (*IAVLTree) Load ¶
Sets the root node by reading from db. If the hash is empty, then sets root to nil.