class StoredMerklePatriciaTrie<V> : MerkleTrie<Bytes, V>
(source)
A MerkleTrie that persists trie nodes to a MerkleStorage key/value store.
Parameters
StoredMerklePatriciaTrie(storage: MerkleStorage, valueSerializer: (V) -> Bytes, valueDeserializer: (Bytes) -> V) StoredMerklePatriciaTrie(storage: MerkleStorage, rootHash: Bytes32, valueSerializer: (V) -> Bytes, valueDeserializer: (Bytes) -> V)
Create a trie. |
fun clearCache(): Unit
Forces any cached trie nodes to be released, so they can be garbage collected. |
|
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<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. |
|
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. |
|
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. |
fun <V> create(storage: MerkleStorage, valueSerializer: Function<V, Bytes>, valueDeserializer: Function<Bytes, V>): StoredMerklePatriciaTrie<V> fun <V> create(storage: MerkleStorage, rootHash: Bytes32, valueSerializer: Function<V, Bytes>, valueDeserializer: Function<Bytes, V>): StoredMerklePatriciaTrie<V>
Create a trie. |
|
fun storingBytes(storage: MerkleStorage): StoredMerklePatriciaTrie<Bytes>
Create a trie with value of type Bytes. fun storingBytes(storage: MerkleStorage, rootHash: Bytes32): StoredMerklePatriciaTrie<Bytes>
Create a trie with keys and values of type Bytes. |
|
fun storingStrings(storage: MerkleStorage): StoredMerklePatriciaTrie<String>
Create a trie with value of type String. fun storingStrings(storage: MerkleStorage, rootHash: Bytes32): StoredMerklePatriciaTrie<String>
Create a trie with keys and values of type String. |