pub struct TickHistogram { /* private fields */ }Expand description
Sparse dyadic histogram over the tick axis.
Implementations§
Source§impl TickHistogram
impl TickHistogram
Sourcepub fn observe(&mut self, node_key: u128)
pub fn observe(&mut self, node_key: u128)
Observe one posting’s node key (the flipped key-space u128 the
temporal-index CF prefixes with; instants contribute their exact tick
key, so splits refine to true tick resolution under dense clusters).
Sourcepub fn merge(&mut self, other: &Self)
pub fn merge(&mut self, other: &Self)
Algebraic merge: union with addition, nesting resolution (a bucket
containing finer ones splits until the cut is laminar again; counts
halve per level), then coarsening under MAX_BUCKETS.
Sourcepub fn total_postings(&self) -> u64
pub fn total_postings(&self) -> u64
Total postings observed (advisory; Put-only like total_puts).
Sourcepub fn bucket_count(&self) -> usize
pub fn bucket_count(&self) -> usize
Number of buckets in the cut (tests / diagnostics).
Sourcepub fn estimate_window(&self, begin: i128, end: i128) -> u64
pub fn estimate_window(&self, begin: i128, end: i128) -> u64
Row-count estimate for the inclusive tick window [begin, end].
The window’s exact canonical decomposition (the same walk the scan
uses) resolves per node: exact bucket → its count; finer buckets
under it → their sum; only a coarser ancestor → the ancestor’s count
times the width share. No overlap evidence falls back to the uniform
density total / observed_span × window_width. Never zero: estimates
order plan alternatives, they never prune (§10), and the profile is
compaction-stale by construction, so a stats zero is not a proof of
zero.
Sourcepub fn encode_body(&self, out: &mut Vec<u8>)
pub fn encode_body(&self, out: &mut Vec<u8>)
Serialize: buckets in (level, index) order, fixed-width fields.
Sourcepub fn decode_body(buf: &mut &[u8]) -> Result<Self, StatsError>
pub fn decode_body(buf: &mut &[u8]) -> Result<Self, StatsError>
Parse a body produced by Self::encode_body; trailing input is the
caller’s (the profile continues after this section).
Trait Implementations§
Source§impl Clone for TickHistogram
impl Clone for TickHistogram
Source§fn clone(&self) -> TickHistogram
fn clone(&self) -> TickHistogram
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more