Documentation ¶
Overview ¶
Package mavl 默克尔平衡树算法实现以及裁剪
Index ¶
- Variables
- func ClosePrune()
- func DelKVPair(db dbm.DB, storeDel *types.StoreGet) ([]byte, [][]byte, error)
- func DelLeafCountKV(db dbm.DB, blockHeight int64) error
- func EnableMVCC(enable bool)
- func EnableMavlPrefix(enable bool)
- func EnablePrune(enable bool)
- func GetKVPair(db dbm.DB, storeGet *types.StoreGet) ([][]byte, error)
- func GetKVPairProof(db dbm.DB, roothash []byte, key []byte) ([]byte, error)
- func InnerNodeProofHash(childHash []byte, branch *types.InnerNode) []byte
- func IterateRangeByStateHash(db dbm.DB, statehash, start, end []byte, ascending bool, ...)
- func PrintLeafNodeParent(db dbm.DB, key, hash []byte, height int64)
- func PrintMemStats(height int64)
- func PrintNode(node *Node)
- func PrintNodeDb(db dbm.DB, hash []byte)
- func PrintSameLeafKey(db dbm.DB, key string)
- func PrintTreeLeaf(db dbm.DB, roothash []byte)
- func PruningTree(db dbm.DB, curHeight int64)
- func PruningTreePrintDB(db dbm.DB, prefix []byte)
- func SetKVPair(db dbm.DB, storeSet *types.StoreSet, sync bool) ([]byte, error)
- func SetPruneHeight(height int)
- func VerifyKVPairProof(db dbm.DB, roothash []byte, keyvalue types.KeyValue, proof []byte) bool
- type Node
- type Proof
- type Tree
- func (t *Tree) ConstructProof(key []byte) (value []byte, proof *Proof)
- func (t *Tree) Copy() *Tree
- func (t *Tree) Get(key []byte) (index int32, value []byte, exists bool)
- func (t *Tree) GetByIndex(index int32) (key []byte, value []byte)
- func (t *Tree) GetHash(key []byte) (index int32, hash []byte, exists bool)
- func (t *Tree) Has(key []byte) bool
- func (t *Tree) Hash() []byte
- func (t *Tree) Height() int32
- func (t *Tree) Iterate(fn func(key []byte, value []byte) bool) (stopped bool)
- func (t *Tree) IterateRange(start, end []byte, ascending bool, fn func(key []byte, value []byte) bool) (stopped bool)
- func (t *Tree) IterateRangeInclusive(start, end []byte, ascending bool, fn func(key, value []byte) bool) (stopped bool)
- func (t *Tree) Load(hash []byte) (err error)
- func (t *Tree) Proof(key []byte) (value []byte, proofBytes []byte, exists bool)
- func (t *Tree) Remove(key []byte) (value []byte, removed bool)
- func (t *Tree) RemoveLeafCountKey(height int64)
- func (t *Tree) Save() []byte
- func (t *Tree) Set(key []byte, value []byte) (updated bool)
- func (t *Tree) SetBlockHeight(height int64)
- func (t *Tree) Size() int32
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrNodeNotExist node is not exist ErrNodeNotExist = errors.New("ErrNodeNotExist") )
Functions ¶
func DelLeafCountKV ¶
DelLeafCountKV 回退时候用于删除叶子节点的索引节点
func GetKVPairProof ¶
GetKVPairProof 获取指定k:v pair的proof证明
func InnerNodeProofHash ¶
InnerNodeProofHash 计算inner节点的hash
func IterateRangeByStateHash ¶
func IterateRangeByStateHash(db dbm.DB, statehash, start, end []byte, ascending bool, fn func([]byte, []byte) bool)
IterateRangeByStateHash 在start和end之间的键进行迭代回调[start, end)
func PrintLeafNodeParent ¶
PrintLeafNodeParent 查询叶子节点的父节点
func PrintTreeLeaf ¶
PrintTreeLeaf 通过roothash打印所有叶子节点
func PruningTreePrintDB ¶
PruningTreePrintDB pruning tree print db
Types ¶
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
Node merkle avl Node
type Proof ¶
Proof merkle avl tree proof证明结构体
type Tree ¶
type Tree struct {
// contains filtered or unexported fields
}
Tree merkle avl tree
func (*Tree) ConstructProof ¶
ConstructProof Returns nil, nil if key is not in tree.
func (*Tree) GetByIndex ¶
GetByIndex 通过index获取leaf节点信息
func (*Tree) IterateRange ¶
func (t *Tree) IterateRange(start, end []byte, ascending bool, fn func(key []byte, value []byte) bool) (stopped bool)
IterateRange 在start和end之间的键进行迭代回调[start, end)
func (*Tree) IterateRangeInclusive ¶
func (t *Tree) IterateRangeInclusive(start, end []byte, ascending bool, fn func(key, value []byte) bool) (stopped bool)
IterateRangeInclusive 在start和end之间的键进行迭代回调[start, end]
func (*Tree) RemoveLeafCountKey ¶
RemoveLeafCountKey 删除叶子节点的索引节点(防止裁剪时候回退产生的误删除)
func (*Tree) SetBlockHeight ¶
SetBlockHeight 设置block高度到tree
Click to show internal directories.
Click to hide internal directories.