pub struct RunCounter { /* private fields */ }Expand description
Per-run counting state for one (constraint, head) run.
The backend loops feed every visible row to the mode’s observe_*
method (Self::observe_rows, Self::observe_distinct_terms, or
Self::observe_distinct_graphs); Self::total is the run length
to emit as DomainScanCountHit::count. Only the mode’s own counters
are maintained; no term is decoded on any mode’s behalf (Rows never
needs one, and the distinct modes compare or store the term’s encoded
bytes — raw region bytes, so payloads are never validated; see the
module-level corruption contract).
Implementations§
Source§impl RunCounter
impl RunCounter
Sourcepub fn new(mode: DomainCountMode) -> Self
pub fn new(mode: DomainCountMode) -> Self
Fresh counter for one run of mode; totals start at zero.
Sourcepub fn observe_rows(&mut self)
pub fn observe_rows(&mut self)
Fold one visible row in DomainCountMode::Rows.
Sourcepub fn observe_distinct_terms(&mut self, key: &[u8], slot2: &Range<usize>)
pub fn observe_distinct_terms(&mut self, key: &[u8], slot2: &Range<usize>)
Fold one visible row in DomainCountMode::DistinctTerms.
slot2 locates the slot-2 term inside key — the component directly
after the head, contiguous per head, so “differs from the previous
row’s region” is exactly “new distinct term”.
Sourcepub fn observe_distinct_graphs(&mut self, graph: &[u8])
pub fn observe_distinct_graphs(&mut self, graph: &[u8])
Fold one visible row in DomainCountMode::DistinctGraphs: graph
is the G region (slot-2 end to logical-prefix end; empty for the
default graph).
Sourcepub fn total(&self) -> u64
pub fn total(&self) -> u64
Run length to emit as DomainScanCountHit::count.