tuweni / org.apache.tuweni.trie / MerkleTrie

MerkleTrie

interface MerkleTrie<in K, V> (source)

A Merkle Trie.

Functions

get

Returns the value that corresponds to the specified key, or an empty byte array if no such value exists.

abstract suspend fun get(key: K): V?

getAsync

Returns the value that corresponds to the specified key, or an empty byte array if no such value exists.

open fun getAsync(key: K): AsyncResult<V?>
open fun getAsync(dispatcher: CoroutineDispatcher, key: K): AsyncResult<V?>

put

Updates the value that corresponds to the specified key, creating the value if one does not already exist.

abstract suspend fun put(key: K, value: V?): Unit

putAsync

Updates the value that corresponds to the specified key, creating the value if one does not already exist.

open fun putAsync(key: K, value: V?): AsyncCompletion
open fun putAsync(dispatcher: CoroutineDispatcher, key: K, value: V?): AsyncCompletion

remove

Deletes the value that corresponds to the specified key, if such a value exists.

abstract suspend fun remove(key: K): Unit

removeAsync

Deletes the value that corresponds to the specified key, if such a value exists.

open fun removeAsync(key: K): AsyncCompletion
open fun removeAsync(dispatcher: CoroutineDispatcher, key: K): AsyncCompletion

rootHash

Returns the KECCAK256 hash of the root node of the trie.

abstract fun rootHash(): Bytes32

Companion Object Properties

EMPTY_TRIE_ROOT_HASH

The root hash of an empty tree.

val EMPTY_TRIE_ROOT_HASH: Bytes32

Inheritors

MerklePatriciaTrie

An in-memory MerkleTrie.

class MerklePatriciaTrie<V> : MerkleTrie<Bytes, V>

StoredMerklePatriciaTrie

A MerkleTrie that persists trie nodes to a MerkleStorage key/value store.

class StoredMerklePatriciaTrie<V> : MerkleTrie<Bytes, V>