pub struct EProcessThrottle { /* private fields */ }Expand description
Anytime-valid recompute throttle using e-process (test martingale) control.
See module-level docs for the mathematical model and guarantees.
Implementations§
Source§impl EProcessThrottle
impl EProcessThrottle
Sourcepub fn new(config: ThrottleConfig) -> Self
pub fn new(config: ThrottleConfig) -> Self
Create a new throttle with the given configuration.
Sourcepub fn new_at(config: ThrottleConfig, now: Instant) -> Self
pub fn new_at(config: ThrottleConfig, now: Instant) -> Self
Create a new throttle at a specific time (for deterministic testing).
Sourcepub fn observe(&mut self, matched: bool) -> ThrottleDecision
pub fn observe(&mut self, matched: bool) -> ThrottleDecision
Observe a single event. matched indicates whether this observation
is evidence for recomputation (e.g., the log line matched the query).
Returns a ThrottleDecision indicating whether to recompute.
Sourcepub fn observe_at(&mut self, matched: bool, now: Instant) -> ThrottleDecision
pub fn observe_at(&mut self, matched: bool, now: Instant) -> ThrottleDecision
Observe at a specific time (for deterministic testing).
Sourcepub fn reset(&mut self)
pub fn reset(&mut self)
Manually trigger a recompute (e.g., when the query changes). Resets the e-process state.
Sourcepub fn set_mu_0(&mut self, mu_0: f64)
pub fn set_mu_0(&mut self, mu_0: f64)
Update the null hypothesis match rate μ₀.
Call this when the baseline match rate changes (e.g., new query with different selectivity). Resets the e-process.
Sourcepub fn empirical_match_rate(&self) -> f64
pub fn empirical_match_rate(&self) -> f64
Empirical match rate over the sliding window.
Sourcepub fn observation_count(&self) -> u64
pub fn observation_count(&self) -> u64
Total observation count.
Sourcepub fn stats(&self) -> ThrottleStats
pub fn stats(&self) -> ThrottleStats
Get aggregate statistics.
Sourcepub fn logs(&self) -> &[ThrottleLog]
pub fn logs(&self) -> &[ThrottleLog]
Get decision logs (if logging enabled).
Sourcepub fn clear_logs(&mut self)
pub fn clear_logs(&mut self)
Clear decision logs.