pub struct SimulationLayerHandle { /* private fields */ }Expand description
Cheap-to-clone handle to a SimulationLayer’s captured state.
Implementations§
Source§impl SimulationLayerHandle
impl SimulationLayerHandle
Sourcepub fn register(&self, inv: Box<dyn Invariant + Send>)
pub fn register(&self, inv: Box<dyn Invariant + Send>)
Register an invariant, run on every Self::run_invariants call.
Sourcepub fn reset_for_seed(&self)
pub fn reset_for_seed(&self)
Reset captured events and invariant state for a new seed.
Clears all event vectors, resets the sequence counter, and calls
Invariant::reset on each registered invariant.
Sourcepub fn current_sim_time_ms(&self) -> u64
pub fn current_sim_time_ms(&self) -> u64
Latest known simulation time in milliseconds.
Updated by Self::set_sim_time_ms (the orchestrator pushes after
each sim.step()). Read at capture time to stamp captured events.
Sourcepub fn set_sim_time_ms(&self, ms: u64)
pub fn set_sim_time_ms(&self, ms: u64)
Override the latest known simulation time. Called by the orchestrator to keep the layer’s clock advancing between steps.
Sourcepub fn record_sim_fault(&self, time_ms: u64, fault: &SimFaultEvent)
pub fn record_sim_fault(&self, time_ms: u64, fault: &SimFaultEvent)
Record a runner-injected fault into the timeline.
Stored under the SIM_FAULT_EVENT_NAME event name with
source = "sim", a kind field identifying the fault variant, and
the fault’s payload flattened into fields. time_ms is the sim time
at which the fault occurred (stamped by the engine, not at drain time).
Sourcepub fn run_invariants(&self)
pub fn run_invariants(&self)
Run all registered invariants against the captured events at the current sim time. Called by the orchestrator after each step.
Trait Implementations§
Source§impl Clock for SimulationLayerHandle
impl Clock for SimulationLayerHandle
Source§impl Clone for SimulationLayerHandle
impl Clone for SimulationLayerHandle
Source§fn clone(&self) -> SimulationLayerHandle
fn clone(&self) -> SimulationLayerHandle
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more