pub struct Simulation { /* private fields */ }Implementations§
Source§impl Simulation
impl Simulation
pub const fn decision_state(&self) -> &DecisionState
pub fn decision_ticket(&self, id: DecisionTicketId) -> Option<&DecisionTicket>
pub fn decision_traces(&self) -> &[DecisionTrace]
pub fn decision_attempts(&self) -> &[DecisionAttemptRecord]
pub fn prepare_decision( &self, decision_request_id: DecisionRequestId, command_request_id: Option<CommandRequestId>, ticket_id: DecisionTicketId, policy: &dyn DecisionPolicy, ) -> Result<DecisionEvaluation, CanwuError>
pub fn prepare_decision_at( &self, due_at: SimTime, decision_request_id: DecisionRequestId, command_request_id: Option<CommandRequestId>, ticket_id: DecisionTicketId, policy: &dyn DecisionPolicy, ) -> Result<DecisionEvaluation, CanwuError>
pub fn enqueue_decision( &mut self, due_at: SimTime, priority: i32, request: DecisionIngressRequest, ) -> Result<IngressReceipt, CanwuError>
pub fn drive_decision( &mut self, due_at: SimTime, priority: i32, decision_request_id: DecisionRequestId, command_request_id: Option<CommandRequestId>, ticket_id: DecisionTicketId, policy: &dyn DecisionPolicy, ) -> Result<DecisionEvaluation, CanwuError>
Source§impl Simulation
impl Simulation
pub fn submit( &mut self, envelope: CommandEnvelope, ) -> Result<CommandReceipt, CanwuError>
pub fn enqueue_command( &mut self, due_at: SimTime, priority: i32, request: CommandRequest, ) -> Result<IngressReceipt, CanwuError>
pub fn enqueue_plugin_ingress( &mut self, request: PluginIngressRequest, ) -> Result<IngressReceipt, CanwuError>
pub fn schedule_calendar_boundary( &mut self, due_at: SimTime, cadences: Vec<SystemCadence>, ) -> Result<IngressReceipt, CanwuError>
pub fn process_command( &mut self, request: CommandRequest, ) -> Result<CommandOutcome, CanwuError>
pub fn advance_canonical( &mut self, duration: SimDuration, ) -> Result<Vec<BoundaryReceipt>, CanwuError>
pub fn step_canonical(&mut self) -> Result<Option<BoundaryReceipt>, CanwuError>
Source§impl Simulation
impl Simulation
Sourcepub fn into_compacted(self) -> Result<CompactedSimulation, CanwuError>
pub fn into_compacted(self) -> Result<CompactedSimulation, CanwuError>
Converts this runtime into the opt-in compact journal interface.
Conversion itself preserves the complete retained history. Call
CompactedSimulation::seal_evidence to release a validated segment
explicitly.
Sourcepub fn evidence_cursor(&self) -> Result<EvidenceCursor, CanwuError>
pub fn evidence_cursor(&self) -> Result<EvidenceCursor, CanwuError>
Returns the current monotonic cut through every append-only journal.
Sourcepub fn checkpoint(&self) -> Result<SimulationCheckpoint, CanwuError>
pub fn checkpoint(&self) -> Result<SimulationCheckpoint, CanwuError>
Captures current authoritative state without cloning accumulated evidence.
Sourcepub fn journal_segment_since(
&self,
start: EvidenceCursor,
) -> Result<EvidenceJournalSegment, CanwuError>
pub fn journal_segment_since( &self, start: EvidenceCursor, ) -> Result<EvidenceJournalSegment, CanwuError>
Clones only evidence appended after a previously persisted cursor.
Sourcepub fn checkpoint_journal(&self) -> Result<CheckpointJournal, CanwuError>
pub fn checkpoint_journal(&self) -> Result<CheckpointJournal, CanwuError>
Builds a portable full-save bundle with one segment from genesis.
Sourcepub fn checkpoint_journal_json(&self) -> Result<String, CanwuError>
pub fn checkpoint_journal_json(&self) -> Result<String, CanwuError>
Serializes the portable full-save checkpoint-journal bundle as JSON.
Sourcepub fn from_checkpoint_and_journal(
checkpoint: SimulationCheckpoint,
segments: Vec<EvidenceJournalSegment>,
) -> Result<Self, CanwuError>
pub fn from_checkpoint_and_journal( checkpoint: SimulationCheckpoint, segments: Vec<EvidenceJournalSegment>, ) -> Result<Self, CanwuError>
Restores a checkpoint after proving a contiguous journal prefix.
Sourcepub fn from_checkpoint_journal(
bundle: CheckpointJournal,
) -> Result<Self, CanwuError>
pub fn from_checkpoint_journal( bundle: CheckpointJournal, ) -> Result<Self, CanwuError>
Restores a portable checkpoint-journal bundle.
Sourcepub fn from_checkpoint_journal_with_plugins(
bundle: CheckpointJournal,
plugins: &[&dyn SimulationPlugin],
) -> Result<Self, CanwuError>
pub fn from_checkpoint_journal_with_plugins( bundle: CheckpointJournal, plugins: &[&dyn SimulationPlugin], ) -> Result<Self, CanwuError>
Restores a bundle and rehydrates its exact executable plugin contracts.
Sourcepub fn from_checkpoint_journal_json(json: &str) -> Result<Self, CanwuError>
pub fn from_checkpoint_journal_json(json: &str) -> Result<Self, CanwuError>
Deserializes and restores a portable checkpoint-journal JSON bundle.
Sourcepub fn from_checkpoint_journal_json_with_plugins(
json: &str,
plugins: &[&dyn SimulationPlugin],
) -> Result<Self, CanwuError>
pub fn from_checkpoint_journal_json_with_plugins( json: &str, plugins: &[&dyn SimulationPlugin], ) -> Result<Self, CanwuError>
Deserializes a bundle and rehydrates its exact plugin contracts.
Source§impl Simulation
impl Simulation
Sourcepub fn replay(
seed: u64,
scenario: Scenario,
commands: &[CommandRecord],
final_time: SimTime,
) -> Result<Self, CanwuError>
pub fn replay( seed: u64, scenario: Scenario, commands: &[CommandRecord], final_time: SimTime, ) -> Result<Self, CanwuError>
Reconstructs caller-supplied core commands without proving a recorded
package environment. Use Self::replay_from_journal for exact replay.
Sourcepub fn replay_with_plugins(
seed: u64,
scenario: Scenario,
plugins: &[&dyn SimulationPlugin],
commands: &[CommandRecord],
final_time: SimTime,
) -> Result<Self, CanwuError>
pub fn replay_with_plugins( seed: u64, scenario: Scenario, plugins: &[&dyn SimulationPlugin], commands: &[CommandRecord], final_time: SimTime, ) -> Result<Self, CanwuError>
Reconstructs caller-supplied inputs under caller-supplied plugins. This is not an exact replay identity check.
Sourcepub fn replay_with_boundaries(
seed: u64,
scenario: Scenario,
plugins: &[&dyn SimulationPlugin],
commands: &[CommandRecord],
boundaries: &[BoundaryRecord],
final_time: SimTime,
) -> Result<Self, CanwuError>
pub fn replay_with_boundaries( seed: u64, scenario: Scenario, plugins: &[&dyn SimulationPlugin], commands: &[CommandRecord], boundaries: &[BoundaryRecord], final_time: SimTime, ) -> Result<Self, CanwuError>
Reconstructs caller-supplied inputs and compares supplied boundaries.
Use Self::replay_from_journal when command-only runs must also bind
their recorded run and plugin identities.
Sourcepub fn replay_with_run_manifest(
seed: u64,
scenario: Scenario,
run_manifest: RunManifest,
plugins: &[&dyn SimulationPlugin],
commands: &[CommandRecord],
boundaries: &[BoundaryRecord],
final_time: SimTime,
) -> Result<Self, CanwuError>
pub fn replay_with_run_manifest( seed: u64, scenario: Scenario, run_manifest: RunManifest, plugins: &[&dyn SimulationPlugin], commands: &[CommandRecord], boundaries: &[BoundaryRecord], final_time: SimTime, ) -> Result<Self, CanwuError>
Reconstructs caller-supplied inputs under a caller-supplied run manifest. This is useful for fixtures; it does not establish recorded identity.
Sourcepub fn replay_with_run_configuration(
seed: u64,
scenario: Scenario,
run_manifest: RunManifest,
run_configuration: RunConfiguration,
plugins: &[&dyn SimulationPlugin],
commands: &[CommandRecord],
command_attempts: &[CommandAttemptRecord],
boundaries: &[BoundaryRecord],
final_time: SimTime,
) -> Result<Self, CanwuError>
pub fn replay_with_run_configuration( seed: u64, scenario: Scenario, run_manifest: RunManifest, run_configuration: RunConfiguration, plugins: &[&dyn SimulationPlugin], commands: &[CommandRecord], command_attempts: &[CommandAttemptRecord], boundaries: &[BoundaryRecord], final_time: SimTime, ) -> Result<Self, CanwuError>
Reconstructs caller-supplied inputs under a caller-supplied declared run configuration. This does not establish recorded-environment identity.
Sourcepub fn replay_from_journal(
scenario: Scenario,
plugins: &[&dyn SimulationPlugin],
journal: &ReplayJournal,
) -> Result<Self, CanwuError>
pub fn replay_from_journal( scenario: Scenario, plugins: &[&dyn SimulationPlugin], journal: &ReplayJournal, ) -> Result<Self, CanwuError>
Replays only after the recorded engine, run, seed, and plugin manifests match, then verifies the final checkpoint commitment.
Source§impl Simulation
impl Simulation
pub fn advance( &mut self, duration: SimDuration, ) -> Result<Vec<SimEvent>, CanwuError>
pub fn step(&mut self) -> Result<Vec<SimEvent>, CanwuError>
pub fn advance_until<F>( &mut self, maximum: SimDuration, condition: F, ) -> Result<Vec<SimEvent>, CanwuError>
Source§impl Simulation
impl Simulation
pub fn settle_boundary( &mut self, request: BoundaryRequest, ) -> Result<BoundaryReceipt, CanwuError>
Source§impl Simulation
impl Simulation
Sourcepub fn new(seed: u64, scenario: Scenario) -> Result<Self, CanwuError>
pub fn new(seed: u64, scenario: Scenario) -> Result<Self, CanwuError>
Creates a simulation after validating that scenario references are sound.
Sourcepub fn new_with_plugins(
seed: u64,
scenario: Scenario,
plugins: &[&dyn SimulationPlugin],
) -> Result<Self, CanwuError>
pub fn new_with_plugins( seed: u64, scenario: Scenario, plugins: &[&dyn SimulationPlugin], ) -> Result<Self, CanwuError>
Creates a simulation and activates the plugins required by initial application-defined records before returning a snapshot-capable runtime.
Sourcepub fn new_with_manifest(
seed: u64,
scenario: Scenario,
run_manifest: RunManifest,
) -> Result<Self, CanwuError>
pub fn new_with_manifest( seed: u64, scenario: Scenario, run_manifest: RunManifest, ) -> Result<Self, CanwuError>
Creates a simulation with an exact, persisted run environment identity.
Sourcepub fn new_with_manifest_and_plugins(
seed: u64,
scenario: Scenario,
run_manifest: RunManifest,
plugins: &[&dyn SimulationPlugin],
) -> Result<Self, CanwuError>
pub fn new_with_manifest_and_plugins( seed: u64, scenario: Scenario, run_manifest: RunManifest, plugins: &[&dyn SimulationPlugin], ) -> Result<Self, CanwuError>
Creates a manifested run and activates all initial domain packages before the runtime can be observed or snapshotted.
Sourcepub fn new_with_run_configuration(
seed: u64,
scenario: Scenario,
run_manifest: RunManifest,
run_configuration: RunConfiguration,
) -> Result<Self, CanwuError>
pub fn new_with_run_configuration( seed: u64, scenario: Scenario, run_manifest: RunManifest, run_configuration: RunConfiguration, ) -> Result<Self, CanwuError>
Creates a run whose six policy dimensions are persisted and bound to
the run-configuration artifact in run_manifest.
Sourcepub fn new_with_run_configuration_and_plugins(
seed: u64,
scenario: Scenario,
run_manifest: RunManifest,
run_configuration: RunConfiguration,
plugins: &[&dyn SimulationPlugin],
) -> Result<Self, CanwuError>
pub fn new_with_run_configuration_and_plugins( seed: u64, scenario: Scenario, run_manifest: RunManifest, run_configuration: RunConfiguration, plugins: &[&dyn SimulationPlugin], ) -> Result<Self, CanwuError>
Creates a declared-policy run and activates all initial domain packages before the runtime can be observed or snapshotted.
pub fn demo(seed: u64) -> Result<(Self, DemoIds), CanwuError>
pub fn register_plugin<P: SimulationPlugin + ?Sized>( &mut self, plugin: &P, ) -> Result<(), CanwuError>
pub const fn time(&self) -> SimTime
pub const fn run_manifest(&self) -> &RunManifest
pub const fn run_configuration(&self) -> &RunConfigurationSnapshot
Sourcepub const fn revision(&self) -> u64
pub const fn revision(&self) -> u64
Returns the persisted authoritative transaction revision.
Accepted commands, persisted expected rejections, and completed settlement boundaries each advance it exactly once. Failed work, exact retries, bare clock movement, queued but unadmitted ingress, and plugin setup do not advance it; use the expected-time guard with external commands to detect clock and scheduled-work advancement.
pub fn run_manifest_hash(&self) -> &str
pub fn checkpoint_hash(&self) -> &str
Hash of simulated state and causal evidence. Run-purpose, controller, seat, observation, interaction, and trace policy remain save identity but are deliberately excluded from this authoritative result identity.
pub fn world(&self) -> WorldSnapshot
pub fn knowledge(&self) -> &KnowledgeSnapshot
pub fn events(&self) -> &[SimEvent]
pub fn command_log(&self) -> &[CommandRecord]
pub fn command_attempts(&self) -> &[CommandAttemptRecord]
pub fn ingress_log(&self) -> &[IngressRecord]
pub fn domain_record( &self, reference: &DomainRecordRef, ) -> Option<&DomainRecord>
pub fn typed_domain_record<T: DomainRecordType>( &self, reference: &TypedDomainRecordRef<T>, ) -> Option<&DomainRecord>
pub fn domain_records(&self) -> impl Iterator<Item = &DomainRecord>
pub fn boundaries(&self) -> &[BoundaryRecord]
pub fn random_draws(&self) -> &[RandomDrawRecord]
pub fn boundary_head_hash(&self) -> Option<&str>
pub const fn schema(&self) -> &SchemaRegistry
pub fn plugin_descriptors(&self) -> impl Iterator<Item = &PluginDescriptor>
Sourcepub fn event_audience(&self, event: &SimEvent) -> EventAudience
pub fn event_audience(&self, event: &SimEvent) -> EventAudience
Returns the persisted audience declaration for a plugin event.
Built-in event visibility remains part of the public actor-relative
projection. Unlisted plugin event types deliberately resolve to
EventAudience::Private.