pub struct TickEngine { /* private fields */ }Expand description
Single-threaded tick engine for Lockstep mode.
Owns all simulation state and executes ticks synchronously. Each
execute_tick() call runs the full propagator pipeline, publishes
a snapshot, and returns receipts for any submitted commands.
Implementations§
Source§impl TickEngine
impl TickEngine
Sourcepub fn new(config: WorldConfig) -> Result<Self, ConfigError>
pub fn new(config: WorldConfig) -> Result<Self, ConfigError>
Construct a new tick engine from a WorldConfig.
Validates the configuration, builds the read resolution plan,
constructs the arena, and pre-computes the base field set.
Consumes the WorldConfig.
Sourcepub fn submit_commands(&mut self, commands: Vec<Command>) -> Vec<Receipt>
pub fn submit_commands(&mut self, commands: Vec<Command>) -> Vec<Receipt>
Submit commands to be processed in the next tick.
Returns one receipt per command indicating acceptance or rejection.
Sourcepub fn execute_tick(&mut self) -> Result<TickResult, TickError>
pub fn execute_tick(&mut self) -> Result<TickResult, TickError>
Execute one tick.
Runs the full propagator pipeline, publishes the snapshot, and returns receipts plus metrics. On propagator failure, the tick is rolled back atomically (the staging buffer is abandoned).
Sourcepub fn reset(&mut self) -> Result<(), ConfigError>
pub fn reset(&mut self) -> Result<(), ConfigError>
Reset the engine to its initial state.
Sourcepub fn snapshot(&self) -> Snapshot<'_>
pub fn snapshot(&self) -> Snapshot<'_>
Get a read-only snapshot of the current published generation.
Sourcepub fn owned_snapshot(&self) -> OwnedSnapshot
pub fn owned_snapshot(&self) -> OwnedSnapshot
Get an owned, thread-safe snapshot of the current published generation.
Unlike TickEngine::snapshot(), the returned OwnedSnapshot owns
clones of the segment data and can be sent across thread boundaries.
Sourcepub fn current_tick(&self) -> TickId
pub fn current_tick(&self) -> TickId
Current tick ID.
Sourcepub fn is_tick_disabled(&self) -> bool
pub fn is_tick_disabled(&self) -> bool
Whether ticking is disabled due to consecutive rollbacks.
Sourcepub fn consecutive_rollback_count(&self) -> u32
pub fn consecutive_rollback_count(&self) -> u32
Number of consecutive rollbacks since the last successful tick.
Sourcepub fn last_metrics(&self) -> &StepMetrics
pub fn last_metrics(&self) -> &StepMetrics
Metrics from the most recent successful tick.