@ethereumjs/trie / WalkController
WalkController is an interface to control how the trie is being traversed.
• Readonly
onNode: FoundNodeFunction
packages/trie/src/util/walkController.ts:12
• Readonly
taskExecutor: PrioritizedTaskExecutor
packages/trie/src/util/walkController.ts:13
• Readonly
trie: Trie
packages/trie/src/util/walkController.ts:14
▸ allChildren(node
, key?
): void
Run all children of a node. Priority of these nodes are the key length of the children.
Name | Type | Default value | Description |
---|---|---|---|
node |
TrieNode |
undefined |
Node to get all children of and call onNode on. |
key |
Nibbles |
[] |
The current key which would yield the node when trying to get this node with a get operation. |
void
packages/trie/src/util/walkController.ts:69
▸ onlyBranchIndex(node
, key?
, childIndex
, priority?
): void
Push a branch of a certain BranchNode to the event queue.
Name | Type | Default value | Description |
---|---|---|---|
node |
BranchNode |
undefined |
The node to select a branch on. Should be a BranchNode. |
key |
Nibbles |
[] |
The current key which leads to the corresponding node. |
childIndex |
number |
undefined |
The child index to add to the event queue. |
priority? |
number |
undefined |
Optional priority of the event, defaults to the total key length. |
void
packages/trie/src/util/walkController.ts:120
▸ pushNodeToQueue(nodeRef
, key?
, priority?
): void
Push a node to the queue. If the queue has places left for tasks, the node is executed immediately, otherwise it is queued.
Name | Type | Default value | Description |
---|---|---|---|
nodeRef |
Uint8Array |
undefined |
Push a node reference to the event queue. This reference is a 32-byte keccak hash of the value corresponding to the key . |
key |
Nibbles |
[] |
The current key. |
priority? |
number |
undefined |
Optional priority, defaults to key length |
void
packages/trie/src/util/walkController.ts:97
▸ Static
newWalk(onNode
, trie
, root
, poolSize?
): Promise
<void
>
Async function to create and start a new walk over a trie.
| Name | Type | Description |
| :—— | :—— | :—— |
| onNode
| FoundNodeFunction
| The FoundNodeFunction to call if a node is found. |
|
trie | [
Trie](/ethereumjs-monorepo/packages/mpt/docs/classes/Trie.html) | The trie to walk on. |
|
root |
Uint8Array | The root key to walk on. |
|
poolSize? |
number` | Task execution pool size to prevent OOM errors. Defaults to 500. |
Promise
<void
>