Class PatriciaTries

java.lang.Object
io.hotmoka.patricia.PatriciaTries

public final class PatriciaTries extends Object
Provider of Merkle-Patricia tries.
  • Method Summary

    Modifier and Type
    Method
    Description
    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)
    Yields a Merkle-Patricia trie supported by the underlying store, using the given hashing algorithm to hash nodes, keys and the values.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 trie
      Value - 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 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
      Returns:
      the trie
      Throws:
      TrieException - if the creation cannot be completed correctly