ethereumjs-monorepo

@ethereumjs/trie / WalkController

Class: WalkController

WalkController is an interface to control how the trie is being traversed.

Table of contents

Properties

Methods

Properties

onNode

Readonly onNode: FoundNodeFunction

Defined in

packages/trie/src/util/walkController.ts:12


taskExecutor

Readonly taskExecutor: PrioritizedTaskExecutor

Defined in

packages/trie/src/util/walkController.ts:13


trie

Readonly trie: Trie

Defined in

packages/trie/src/util/walkController.ts:14

Methods

allChildren

allChildren(node, key?): void

Run all children of a node. Priority of these nodes are the key length of the children.

Parameters

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.

Returns

void

Defined in

packages/trie/src/util/walkController.ts:69


onlyBranchIndex

onlyBranchIndex(node, key?, childIndex, priority?): void

Push a branch of a certain BranchNode to the event queue.

Parameters

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.

Returns

void

Defined in

packages/trie/src/util/walkController.ts:120


pushNodeToQueue

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.

Parameters

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

Returns

void

Defined in

packages/trie/src/util/walkController.ts:97


newWalk

Static newWalk(onNode, trie, root, poolSize?): Promise<void>

Async function to create and start a new walk over a trie.

Parameters

| 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. |

Returns

Promise<void>

Defined in

packages/trie/src/util/walkController.ts:39