pub struct Classifier { /* private fields */ }Expand description
Incremental classifier. Feed events in, snapshot out.
Implementations§
Source§impl Classifier
impl Classifier
pub fn new() -> Self
Sourcepub fn push(&mut self, event: Event)
pub fn push(&mut self, event: Event)
Append an event. Events must be monotonically non-decreasing
in ts; the classifier does not re-sort.
Sourcepub fn classify(&self, now: DateTime<Utc>) -> Snapshot
pub fn classify(&self, now: DateTime<Utc>) -> Snapshot
Compute a fresh snapshot as of now.
Uses Snapshot::new, which caps friction at L2. Callers
with engine context (the dispatcher, the TUI’s operator-
state refresh path) should use
Self::classify_with_risk to reach L3/L4.
Sourcepub fn classify_with_risk(
&self,
now: DateTime<Utc>,
risk: RiskContext,
) -> Snapshot
pub fn classify_with_risk( &self, now: DateTime<Utc>, risk: RiskContext, ) -> Snapshot
Compute a fresh snapshot as of now, folding
engine-reported risk context into the friction level.
The event-pure part of the classifier is unchanged — risk
participates only at the final Snapshot construction via
Snapshot::new_with_risk. Passing
RiskContext::default is equivalent to calling
Self::classify.
This entrypoint is what the TUI calls on every tick once
the engine mirror has a live Risk payload; the
additional O(1) work is a pair of integer comparisons and
a branch, so the p95 budget from
classifier_tick_under_budget_on_typical_load is
unaffected.
Sourcepub fn event_count(&self) -> usize
pub fn event_count(&self) -> usize
Total events consumed.
Trait Implementations§
Source§impl Clone for Classifier
impl Clone for Classifier
Source§fn clone(&self) -> Classifier
fn clone(&self) -> Classifier
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more