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 trie
Value - the type of the values of the trie
T - 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

    Constructors
    Modifier
    Constructor
    Description
    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)
    Creates an empty Merkle-Patricia trie supported by the given underlying store, using the given hashing algorithms to hash nodes and values.
    protected
    AbstractPatriciaTrie(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, put

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods 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 nodes
      root - the root of the trie
      hasherForKeys - the hasher for the keys
      hashingForNodes - the hashing algorithm for the nodes of the trie
      hashOfEmpty - the hash of the empty trie
      valueToBytes - a function that marshals values into their byte representation
      bytesToValue - a function that unmarshals bytes into the represented value
      Throws:
      TrieException - if the creation cannot be completed correctly
    • AbstractPatriciaTrie

      protected AbstractPatriciaTrie(T cloned, byte[] root) throws TrieException
      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 yet
      root - the root used to check out the trie
      Throws:
      TrieException - if the creation cannot be completed correctly