pub struct DiffEvidenceLedger { /* private fields */ }Expand description
Fixed-capacity ring buffer for diff strategy decisions.
Pre-allocates all storage up front so that record() never allocates
on the hot path (the record itself is moved in, not cloned).
Implementations§
Source§impl DiffEvidenceLedger
impl DiffEvidenceLedger
Sourcepub fn new(decision_capacity: usize) -> Self
pub fn new(decision_capacity: usize) -> Self
Create a new ledger with the given capacity for decisions.
Transition capacity is set to 1/10 of decision capacity (regime transitions are much rarer than per-frame decisions).
Sourcepub fn record(&mut self, record: DiffStrategyRecord)
pub fn record(&mut self, record: DiffStrategyRecord)
Record a diff strategy decision. Overwrites oldest when full.
Sourcepub fn record_transition(&mut self, transition: RegimeTransition)
pub fn record_transition(&mut self, transition: RegimeTransition)
Record a regime transition explicitly.
Sourcepub fn transition_count(&self) -> usize
pub fn transition_count(&self) -> usize
Number of regime transitions stored.
Sourcepub fn current_regime(&self) -> DiffRegime
pub fn current_regime(&self) -> DiffRegime
Current regime.
Sourcepub fn decisions(&self) -> impl Iterator<Item = &DiffStrategyRecord>
pub fn decisions(&self) -> impl Iterator<Item = &DiffStrategyRecord>
Iterate over stored decisions in insertion order (oldest first).
Sourcepub fn transitions(&self) -> impl Iterator<Item = &RegimeTransition>
pub fn transitions(&self) -> impl Iterator<Item = &RegimeTransition>
Iterate over stored transitions in insertion order (oldest first).
Sourcepub fn last_decision(&self) -> Option<&DiffStrategyRecord>
pub fn last_decision(&self) -> Option<&DiffStrategyRecord>
Get the most recent decision.
Sourcepub fn export_jsonl(&self) -> String
pub fn export_jsonl(&self) -> String
Export all decisions and transitions as JSONL lines.
Sourcepub fn flush_to_sink(&self, sink: &EvidenceSink) -> Result<()>
pub fn flush_to_sink(&self, sink: &EvidenceSink) -> Result<()>
Flush decisions to an evidence sink.