Module io.hotmoka.patricia
Package io.hotmoka.patricia
Class AbstractPatriciaTrie<Key,Value,T extends AbstractPatriciaTrie<Key,Value,T>>
java.lang.Object
io.hotmoka.patricia.internal.AbstractPatriciaTrieImpl<Key,Value,T>
io.hotmoka.patricia.AbstractPatriciaTrie<Key,Value,T>
- Type Parameters:
Key- the type of the keys of the trieValue- the type of the values of the trieT- the type of this trie
- All Implemented Interfaces:
PatriciaTrie<Key,Value, T>
public abstract class AbstractPatriciaTrie<Key,Value,T extends AbstractPatriciaTrie<Key,Value,T>>
extends io.hotmoka.patricia.internal.AbstractPatriciaTrieImpl<Key,Value,T>
Abstract implementation of a Patricia trie.
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractPatriciaTrie(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) Creates an empty Merkle-Patricia trie supported by the given underlying store, using the given hashing algorithms to hash nodes and values.protectedAbstractPatriciaTrie(T cloned, byte[] root) Creates a Merkle-Patricia trie from the given trie, checked out at the given root. -
Method Summary
Methods inherited from class io.hotmoka.patricia.internal.AbstractPatriciaTrieImpl
free, get, getRoot, getStore, malloc, putMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.hotmoka.patricia.api.PatriciaTrie
checkoutAt
-
Constructor Details
-
AbstractPatriciaTrie
protected AbstractPatriciaTrie(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 Creates an empty Merkle-Patricia trie supported by the given underlying store, using the given hashing algorithms to hash nodes and values.- 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- Throws:
TrieException- if the creation cannot be completed correctly
-
AbstractPatriciaTrie
Creates a Merkle-Patricia trie from the given trie, checked out at the given root.- Parameters:
cloned- the trie from which the result will be derived; it is assumed that this trie has been derived by a sequence of put operations passing through the given root, that has not been garbage-collected yetroot- the root used to check out the trie- Throws:
TrieException- if the creation cannot be completed correctly
-