Crate trie_db

source ·
Expand description

Trie interface and implementation.

Re-exports§

Modules§

Structs§

  • A container for storing bytes.
  • A weak reference of Bytes.
  • A Trie implementation which hashes keys and uses a generic HashDB backing database. Additionaly it stores inserted hash-key mappings for later retrieval.
  • Iterator over inserted pairs of key values.
  • A mutable Trie implementation which hashes keys and uses a generic HashDB backing database. Additionaly it stores inserted hash-key mappings for later retrieval.
  • Trie lookup helper object.
  • Nibble-orientated view onto byte-slice, allowing nibble-precision offsets.
  • Owning, nibble-oriented byte vector. Counterpart to NibbleSlice. Nibbles are always left aligned, so making a NibbleVec from a NibbleSlice can get costy.
  • Get trie root and insert visited node in a hash_db. As for all ProcessEncodedNode implementation, it is only for full trie parsing (not existing trie).
  • Double ended iterator for going through all nodes in the trie in pre-order traversal order.
  • Iterator for going through all nodes in the trie in pre-order traversal order.
  • Iterator for going through all nodes in the trie in pre-order traversal order.
  • Trie factory.
  • Calculate the trie root of the trie.
  • Calculate the trie root of the trie. Print a debug trace.
  • Get the trie root node encoding.

Enums§

Traits§

  • Trait modelling datastore keyed by a hash defined by the Hasher.
  • Trait for immutable reference of HashDB.
  • Trait describing an object that can hash a slice of bytes. Used to abstract other types over the hashing algorithm. Defines a single hash method and an Out associated type with the necessary bounds.
  • Trait for trie node encoding/decoding. Uses a type parameter to allow registering positions without colling decode plan.
  • Visitor trait to implement when using trie_visit.
  • Description of what kind of query will be made to the trie.
  • A key-value datastore implemented as a database-backed modified Merkle tree.
  • A cache that can be used to speed-up certain operations when accessing the trie.
  • This trait associates a trie definition with preferred methods. It also contains own default implementations and can be used to allow switching implementation.
  • Extending the TrieIterator trait with DoubleEndedIterator trait.
  • A trie iterator that also supports random access (seek()).
  • Trait with definition of trie layout. Contains all associated trait needed for a trie definition or implementation.
  • A key-value datastore implemented as a database-backed modified Merkle tree.
  • A trie recorder that can be used to record all kind of TrieAccess’s.

Functions§

  • Reconstructs a partial trie DB from a compact representation. The encoding is a vector of mutated trie nodes with those child references omitted. The decode function reads them in order from the given slice, reconstructing the full nodes and inserting them into the given HashDB. It stops after fully constructing one partial trie and returns the root hash and the number of nodes read. If an error occurs during decoding, there are no guarantees about which entries were or were not added to the DB.
  • Variant of ‘decode_compact’ that accept an iterator of encoded nodes as input.
  • Generates a compact representation of the partial trie stored in the given DB. The encoding is a vector of mutated trie nodes with those child references omitted. The mutated trie nodes are listed in pre-order traversal order so that the full nodes can be efficiently reconstructed recursively.
  • Function visiting trie from key value inputs with a ProccessEncodedNode callback. This is the main entry point of this module. Calls to each node occurs ordered by byte key value but with longest keys first (from node to branch to root), this differs from standard byte array ordering a bit.

Type Aliases§

  • Alias accessor to NodeCodec associated Error type from a TrieLayout.
  • Database value
  • Representation of a nible slice (right aligned). It contains a right aligned padded first byte (first pair element is the number of nibbles (0 to max nb nibble - 1), second pair element is the padded nibble), and a slice over the remaining bytes.
  • Trie result type. Boxed to avoid copying around extra space for the Hashers Out on successful queries.
  • Alias accessor to hasher hash output type from a TrieLayout.
  • Trie-Item type used for iterators over trie data.
  • Trie-Item type used for iterators over trie key only.