[][src]Module merk::tree

The core tree data structure.

Structs

NoopCommit

A Commit implementation which does not write to a store and does not prune any nodes from the Tree. Useful when only keeping a tree in memory.

PanicSource

A source of data which panics when called. Useful when creating a store which always keeps the state in memory.

RefWalker

Allows read-only traversal of a Tree, fetching from the given source when traversing to a pruned node. The fetched nodes are then retained in memory until they (possibly) get pruned on the next commit.

Tree

A binary AVL tree data structure, with Merkle hashes.

Walker

Allows traversal of a Tree, fetching from the given source when traversing to a pruned node, detaching children as they are traversed.

Enums

Link

Represents a reference to a child tree node. Links may or may not contain the child's Tree instance (storing its key if not).

Op

An operation to be applied to a key in the store.

Constants

HASH_LENGTH

The length of a Hash (in bytes).

NULL_HASH

A zero-filled Hash.

Traits

Commit

To be used when committing a tree (writing it to a store after applying the changes).

Fetch

A source of data to be used by the tree when encountering a pruned node. This typcially means fetching the tree node from a backing store by its key, but could also implement an in-memory cache for example.

Functions

kv_hash

Hashes a key/value pair.

node_hash

Hashes a node based on the hash of its key/value pair, the hash of its left child (if any), and the hash of its right child (if any).

side_to_str

Type Definitions

Batch

A mapping of keys and operations. Keys should be sorted and unique.

BatchEntry

A single (key, operation) pair.

Hash

A cryptographic hash digest.