Interface PatriciaTrie<Key,Value,T extends PatriciaTrie<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

public interface PatriciaTrie<Key,Value,T extends PatriciaTrie<Key,Value,T>>
A Merkle-Patricia trie.
  • Method Summary

    Modifier and Type
    Method
    Description
    checkoutAt(byte[] root)
    Yields an independent clone of this trie, but for its root, that is set to the provided value.
    get(Key key)
    Yields the value bound to the given key.
    byte[]
    Yields the root of the trie, that can be used as a hash of its content.
    put(Key key, Value value)
    Binds the given key to the given value.
  • Method Details

    • get

      Optional<Value> get(Key key) throws TrieException
      Yields the value bound to the given key.
      Parameters:
      key - the key
      Returns:
      the value, if any
      Throws:
      TrieException - if this Patricia trie is not able to complete the operation correctly
    • put

      T put(Key key, Value value) throws TrieException
      Binds the given key to the given value. It replaces it if it was already present. This trie is not modified, but a new trie is returned instead, identical to this but for the added binding.
      Parameters:
      key - the key
      value - the value
      Returns:
      the resulting, modified Patricia trie
      Throws:
      TrieException - if this Patricia trie is not able to complete the operation correctly
    • getRoot

      byte[] getRoot() throws TrieException
      Yields the root of the trie, that can be used as a hash of its content.
      Returns:
      the root
      Throws:
      TrieException - if this Patricia trie is not able to complete the operation correctly
    • checkoutAt

      T checkoutAt(byte[] root) throws TrieException
      Yields an independent clone of this trie, but for its root, that is set to the provided value.
      Parameters:
      root - the root to use in the cloned trie
      Returns:
      the resulting, cloned trie
      Throws:
      TrieException - if this Patricia trie is not able to complete the operation correctly