java.lang.Object
io.hotmoka.patricia.PatriciaTries
Provider of Merkle-Patricia tries.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <Key,Value>
PatriciaTrie<Key,Value, ?> of(KeyValueStore store, byte[] root, io.hotmoka.crypto.api.Hasher<? super Key> hasherForKeys, io.hotmoka.crypto.api.HashingAlgorithm hashingForNodes, byte[] hashOfEmpty, ToBytes<? super Value> valueToBytes, FromBytes<? extends Value> bytesToValue) Yields a Merkle-Patricia trie supported by the underlying store, using the given hashing algorithm to hash nodes, keys and the values.
-
Method Details
-
of
public static <Key,Value> PatriciaTrie<Key,Value, of?> (KeyValueStore store, byte[] root, io.hotmoka.crypto.api.Hasher<? super Key> hasherForKeys, io.hotmoka.crypto.api.HashingAlgorithm hashingForNodes, byte[] hashOfEmpty, ToBytes<? super Value> valueToBytes, FromBytes<? extends Value> bytesToValue) throws TrieException Yields a Merkle-Patricia trie supported by the underlying store, using the given hashing algorithm to hash nodes, keys and the values.- Type Parameters:
Key- the type of the keys of the trieValue- the type of the values of the trie- Parameters:
store- the store used to store the nodes of the tree, as a mapping from nodes' hashes to the marshalled representation of the nodesroot- the root of the triehasherForKeys- the hasher for the keyshashingForNodes- the hashing algorithm for the nodes of the triehashOfEmpty- the hash of the empty trievalueToBytes- a function that marshals values into their byte representationbytesToValue- a function that unmarshals bytes into the represented value- Returns:
- the trie
- Throws:
TrieException- if the creation cannot be completed correctly
-