pub struct NormalizeFold { /* private fields */ }Expand description
The server-side serializer (§4): one per registered normalized query. Fold each
committed transaction’s CaughtChanges with fold to get that
tick’s NormalizedOps. The footprint persists across ticks; the snapshot is simply
the first fold over the hydrate batch (every row 0→1 ⇒ all Adds).
Implementations§
Source§impl NormalizeFold
impl NormalizeFold
Sourcepub fn new(ast: &Ast, pk: HashMap<Box<str>, Vec<usize>>) -> NormalizeFold
pub fn new(ast: &Ast, pk: HashMap<Box<str>, Vec<usize>>) -> NormalizeFold
Build a fold for the query ast, with pk giving each table’s primary-key column
indices (the server derives this from its source schemas; tests pass it inline).
Panics if pk omits a table the query’s tree can surface — a build-time config
invariant, not a data-reachable error.
Sourcepub fn tree(&self) -> &TableNode
pub fn tree(&self) -> &TableNode
The query’s table tree (slot → child table), derived from the AST.
Sourcepub fn footprint_snapshot(&self) -> Vec<NormalizedOp>
pub fn footprint_snapshot(&self) -> Vec<NormalizedOp>
The current footprint as a seq-0 snapshot: one NormalizedOp::Add per live row,
in deterministic (sorted by table, then PK) order. This baselines a late
subscriber attaching to an already-hydrated shared query from the cached
footprint, without re-running the engine pipeline (RINDLE-SERVER-DESIGN.md §11) —
the membership is binary on the wire, so the intra-query refcount is not surfaced.
Sourcepub fn fold(&mut self, changes: &[CaughtChange]) -> Vec<NormalizedOp>
pub fn fold(&mut self, changes: &[CaughtChange]) -> Vec<NormalizedOp>
Fold one committed transaction (or the hydrate snapshot) into its net
NormalizedOps, updating the persistent footprint. An empty / no-membership-
change tick returns [].
Sourcepub fn fold_footprint_only(&mut self, changes: &[CaughtChange])
pub fn fold_footprint_only(&mut self, changes: &[CaughtChange])
Update the footprint for one transaction without producing wire ops — the
allocation-light path for a query nobody is currently receiving (a pinned, zero-
subscriber materialization) and for the hydrate fold (whose ops the drain discards,
baselining late subscribers off footprint_snapshot
instead). It skips the per-tick diff map (the Tick), the tick-start row capture, and
the emit pass entirely — exactly the allocations the wiki-demo RSS profiling traced
the glibc retention to. The footprint it leaves is byte-identical to what
fold would leave, so a later subscriber’s snapshot is unaffected.