Documentation ¶
Index ¶
- type MergedNodeSet
- type Node
- type NodeSet
- func (set *NodeSet) AddLeaf(parent common.Hash, blob []byte)
- func (set *NodeSet) AddNode(path []byte, n *Node)
- func (set *NodeSet) ForEachWithOrder(callback func(path string, n *Node))
- func (set *NodeSet) Hashes() []common.Hash
- func (set *NodeSet) Merge(owner common.Hash, nodes map[string]*Node) error
- func (set *NodeSet) Size() (int, int)
- func (set *NodeSet) Summary() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MergedNodeSet ¶
MergedNodeSet represents a merged node set for a group of tries.
func NewMergedNodeSet ¶
func NewMergedNodeSet() *MergedNodeSet
NewMergedNodeSet initializes an empty merged set.
func NewWithNodeSet ¶
func NewWithNodeSet(set *NodeSet) *MergedNodeSet
NewWithNodeSet constructs a merged nodeset with the provided single set.
func (*MergedNodeSet) Flatten ¶ added in v0.13.2
func (set *MergedNodeSet) Flatten() map[common.Hash]map[string]*Node
Flatten returns a two-dimensional map for internal nodes.
func (*MergedNodeSet) Merge ¶
func (set *MergedNodeSet) Merge(other *NodeSet) error
Merge merges the provided dirty nodes of a trie into the set. The assumption is held that no duplicated set belonging to the same trie will be merged twice.
type Node ¶
type Node struct { Hash common.Hash // Node hash, empty for deleted node Blob []byte // Encoded node blob, nil for the deleted node }
Node is a wrapper which contains the encoded blob of the trie node and its node hash. It is general enough that can be used to represent trie node corresponding to different trie implementations.
func NewDeleted ¶ added in v0.13.2
func NewDeleted() *Node
NewDeleted constructs a node which is deleted.
type NodeSet ¶
type NodeSet struct { Owner common.Hash Leaves []*leaf Nodes map[string]*Node // contains filtered or unexported fields }
NodeSet contains a set of nodes collected during the commit operation. Each node is keyed by path. It's not thread-safe to use.
func NewNodeSet ¶
NewNodeSet initializes a node set. The owner is zero for the account trie and the owning account address hash for storage tries.
func (*NodeSet) AddLeaf ¶
AddLeaf adds the provided leaf node into set. TODO(rjl493456442) how can we get rid of it?
func (*NodeSet) ForEachWithOrder ¶
ForEachWithOrder iterates the nodes with the order from bottom to top, right to left, nodes with the longest path will be iterated first.
func (*NodeSet) Hashes ¶
Hashes returns the hashes of all updated nodes. TODO(rjl493456442) how can we get rid of it?