class MerklePatriciaTrie<V> : MerkleTrie<Bytes, V> (source)
An in-memory MerkleTrie.
valueSerializer - A function for serializing values to bytes.
Parameters
MerklePatriciaTrie(valueSerializer: Function<V, Bytes>)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. |
|
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. |
|
suspend fun remove(key: Bytes): Unit
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(key: K): AsyncResult<Optional<V>>
Returns the value that corresponds to the specified key, or an empty byte array if no such value exists. |
|
open fun putAsync(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(key: K): AsyncCompletion
Deletes the value that corresponds to the specified key, if such a value exists. |
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. |