Class PatriciaTries

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

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

    • of

      public static <Key, Value extends io.hotmoka.marshalling.api.Marshallable> PatriciaTrie<Key,Value> of(KeyValueStore store, Hasher<? super Key> hasherForKeys, HashingAlgorithm hashingForNodes, io.hotmoka.marshalling.api.Unmarshaller<? extends Value> valueUnmarshaller, PatriciaTries.UnmarshallingContextSupplier unmarshallingContextSupplier, long numberOfCommits)
      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 a mapping from nodes' hashes to their content
      hasherForKeys - the hasher for the keys
      hashingForNodes - the hashing algorithm for the nodes of the trie
      valueUnmarshaller - a function able to unmarshall a value from its byte representation
      unmarshallingContextSupplier - the supplier of the unmarshalling context
      numberOfCommits - the current number of commits already executed on the store; this trie will record which data must be garbage collected (eventually) as result of the store updates performed during that commit; this could be -1L if the trie is only used or reading
      Returns:
      the trie