package trienode
import "github.com/ethereum/go-ethereum/trie/trienode"
Index ¶
- type MergedNodeSet
- func NewMergedNodeSet() *MergedNodeSet
- func NewWithNodeSet(set *NodeSet) *MergedNodeSet
- func (set *MergedNodeSet) Flatten() map[common.Hash]map[string]*Node
- func (set *MergedNodeSet) Merge(other *NodeSet) error
- type Node
- func New(hash common.Hash, blob []byte) *Node
- func NewDeleted() *Node
- func (n *Node) IsDeleted() bool
- func (n *Node) Size() int
- type NodeSet
- func NewNodeSet(owner common.Hash) *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) HashSet() map[common.Hash][]byte
- func (set *NodeSet) Merge(owner common.Hash, nodes map[string]*Node) error
- func (set *NodeSet) MergeSet(other *NodeSet) error
- func (set *NodeSet) Size() (int, int)
- func (set *NodeSet) Summary() string
- type ProofList
- func (n ProofList) DataSize() int
- func (n *ProofList) Delete(key []byte) error
- func (n *ProofList) Put(key []byte, value []byte) error
- func (n ProofList) Set() *ProofSet
- func (n ProofList) Store(db ethdb.KeyValueWriter)
- type ProofSet
- func NewProofSet() *ProofSet
- func (db *ProofSet) DataSize() int
- func (db *ProofSet) Delete(key []byte) error
- func (db *ProofSet) DeleteRange(start, end []byte) error
- func (db *ProofSet) Get(key []byte) ([]byte, error)
- func (db *ProofSet) Has(key []byte) (bool, error)
- func (db *ProofSet) KeyCount() int
- func (db *ProofSet) List() [][]byte
- func (db *ProofSet) Put(key []byte, value []byte) error
- func (db *ProofSet) Store(target ethdb.KeyValueWriter)
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 ¶
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 New ¶
New constructs a node with provided node information.
func NewDeleted ¶
func NewDeleted() *Node
NewDeleted constructs a node which is deleted.
func (*Node) IsDeleted ¶
IsDeleted returns the indicator if the node is marked as deleted.
func (*Node) Size ¶
Size returns the total memory size used by this node.
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) AddNode ¶
AddNode adds the provided node into set.
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) HashSet ¶
HashSet returns a set of trie nodes keyed by node hash.
func (*NodeSet) Merge ¶
Merge adds a set of nodes into the set.
func (*NodeSet) MergeSet ¶
MergeSet merges this 'set' with 'other'. It assumes that the sets are disjoint, and thus does not deduplicate data (count deletes, dedup leaves etc).
func (*NodeSet) Size ¶
Size returns the number of dirty nodes in set.
func (*NodeSet) Summary ¶
Summary returns a string-representation of the NodeSet.
type ProofList ¶
ProofList stores an ordered list of trie nodes. It implements ethdb.KeyValueWriter.
func (ProofList) DataSize ¶
DataSize returns the aggregated data size of nodes in the list
func (*ProofList) Delete ¶
Delete panics as there's no reason to remove a node from the list.
func (*ProofList) Put ¶
Put stores a new node at the end of the list
func (ProofList) Set ¶
Set converts the node list to a ProofSet
func (ProofList) Store ¶
func (n ProofList) Store(db ethdb.KeyValueWriter)
Store writes the contents of the list to the given database
type ProofSet ¶
type ProofSet struct {
// contains filtered or unexported fields
}
ProofSet stores a set of trie nodes. It implements trie.Database and can also act as a cache for another trie.Database.
func NewProofSet ¶
func NewProofSet() *ProofSet
NewProofSet creates an empty node set
func (*ProofSet) DataSize ¶
DataSize returns the aggregated data size of nodes in the set
func (*ProofSet) Delete ¶
Delete removes a node from the set
func (*ProofSet) DeleteRange ¶
func (*ProofSet) Get ¶
Get returns a stored node
func (*ProofSet) Has ¶
Has returns true if the node set contains the given key
func (*ProofSet) KeyCount ¶
KeyCount returns the number of nodes in the set
func (*ProofSet) List ¶
List converts the node set to a slice of bytes.
func (*ProofSet) Put ¶
Put stores a new node in the set
func (*ProofSet) Store ¶
func (db *ProofSet) Store(target ethdb.KeyValueWriter)
Store writes the contents of the set to the given database
Source Files ¶
- Version
- v1.15.11 (latest)
- Published
- May 5, 2025
- Platform
- linux/amd64
- Imports
- 10 packages
- Last checked
- 15 hours ago –
Tools for package owners.