merkle-trie / org.apache.tuweni.trie / MerkleTrie

MerkleTrie

interface MerkleTrie<in K, V> (source)

A Merkle Trie.

Functions

get

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

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

getAsync

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

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

put

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

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

putAsync

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

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

remove

abstract suspend fun remove(key: K): Unit

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

removeAsync

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

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

rootHash

abstract fun rootHash(): Bytes32

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

Companion Object Properties

EMPTY_TRIE_ROOT_HASH

val EMPTY_TRIE_ROOT_HASH: Bytes32

The root hash of an empty tree.

Inheritors

MerklePatriciaTrie

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

An in-memory MerkleTrie.

StoredMerklePatriciaTrie

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

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