class MerklePatriciaTrie<V> : MerkleTrie<Bytes, V>
(source)
An in-memory MerkleTrie.
valueSerializer
- A function for serializing values to bytes.
Parameters
MerklePatriciaTrie(valueSerializer: (V) -> Bytes)
Creates an empty trie. |
suspend fun get(key: Bytes): V?
Returns the value that corresponds to the specified key, or an empty byte array if no such value exists. |
|
fun getAsync(key: Bytes): AsyncResult<V?>
Returns the value that corresponds to the specified key, or an empty byte array if no such value exists. |
|
suspend fun put(key: Bytes, value: V?): Unit
Updates the value that corresponds to the specified key, creating the value if one does not already exist. |
|
fun putAsync(key: Bytes, value: V?): AsyncCompletion
Updates the value that corresponds to the specified key, creating the value if one does not already exist. |
|
suspend fun remove(key: Bytes): Unit
Deletes the value that corresponds to the specified key, if such a value exists. |
|
fun removeAsync(key: Bytes): AsyncCompletion
Deletes the value that corresponds to the specified key, if such a value exists. |
|
fun rootHash(): Bytes32
Returns the KECCAK256 hash of the root node of the trie. |
|
fun toString(): String |
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. |
|
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. |
|
open fun removeAsync(dispatcher: CoroutineDispatcher, key: K): AsyncCompletion
Deletes the value that corresponds to the specified key, if such a value exists. |
fun <V> create(valueSerializer: Function<V, Bytes>): MerklePatriciaTrie<V>
Create a trie. |
|
fun storingBytes(): MerklePatriciaTrie<Bytes>
Create a trie with keys and values of type Bytes. |
|
fun storingStrings(): MerklePatriciaTrie<String>
Create a trie with value of type String. |