Skip to main content

Module engine

Module engine 

Source
Expand description

The single-algorithm canonical-log engine over the spine.

A AlgView is one algorithm’s continuation state — its hasher, its committed epoch intervals, and its frontier stack — and the free functions here are the structural operations over it: the base-k frontier carry, the member-root fold, inclusion/consistency proof generation, and the historical root reconstructions. Every operation that touches stored bytes reads them through a borrowed NodeReader; the engine never owns the store, so the polydigest combinator can drive N views over one shared substrate without duplicating leaf data (D14). The engine names no epoch concept: a view’s epoch intervals are read locally only to project a coordinate’s null/active value, never to bind a cross-tree timeline.

Structs§

AlgView
One algorithm’s single-tree continuation state: its hasher, committed epoch intervals, and frontier stack. This is the per-algorithm frontier only (D14) — the shared leaf data lives once in the combinator’s store, never here.

Enums§

LogKind
Whether log-level appends are flat leaf appends or subtree appends.

Traits§

NodeReader
A borrowed read substrate the single-algorithm engine folds over.

Functions§

carry
One step of the base-k frontier carry for a single algorithm view.
compute_root
Compute the member root from an algorithm’s in-memory frontier — the MMR backward-bag of its frontier peaks under its own hash.
consistency_proof
Generate a consistency proof between old_size and new_size for the algorithm view. Returns None when the request is out of range.
frontier_peaks
Gather an algorithm’s frontier peaks at size — the digests of the perfect k-ary subtrees frontier_for_size names, the structural snapshot facet a spine::Seal freezes. Each peak is the algorithm’s null constant for a coordinate whose range carries no active leaf.
get_node_hash
Retrieve a node hash from the read substrate, or return the algorithm’s null constant if the coordinate’s range carries no active leaf.
inclusion_proof
Generate an inclusion proof for index in a tree of size tree_size for the algorithm view, reading nodes through reader. Returns None when out of range or tree_size exceeds the algorithm’s committed size.
leaf_proof
Produce a self-contained spine::LeafProof for index in a tree of size tree_size. Returns None when no inclusion proof exists.
peak_at
The materialized digest of the frontier peak at coordinate (left, height) — one perfect k-ary subtree root of the frontier. Returns the algorithm’s null constant for a coordinate whose range carries no active leaf.
reconstruct_subtree_root
Recursively resolve a subtree root over the read substrate and collect the mixed boundary nodes that must be persisted (used when reopening a frozen algorithm’s frontier). Returns (root, mixed_nodes) where mixed_nodes are (left, height, hash) triples.
reconstruct_view
Reconstruct an algorithm’s frontier view from the read substrate at global_size. The hasher and committed epochs are supplied by the combinator (which owns the timeline); the frontier peaks are read back.
root_for_at
Retrieve the raw member root for the algorithm at a historical tree size.
validate_epochs
Validate an algorithm’s committed epoch intervals against the global size.

Type Aliases§

ReadResult
The Result a NodeReader read yields: a value T or the backend’s own error. Aliased so the trait’s impl Future return types stay readable.