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_from_journal(
plugins: &[&dyn SimulationPlugin],
journal: &ReplayJournal,
) -> Result<Self, CanwuError>
pub fn replay_from_journal( 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.
Sourcepub fn replay_from_journal_json(
plugins: &[&dyn SimulationPlugin],
json: &str,
) -> Result<Self, CanwuError>
pub fn replay_from_journal_json( plugins: &[&dyn SimulationPlugin], json: &str, ) -> Result<Self, CanwuError>
Deserializes a Format 6 replay journal with recursive unknown-field rejection, then performs the exact environment-bound replay.
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 entities(&self) -> impl Iterator<Item = &EntityRef>
pub fn entity_exists(&self, entity: &EntityRef) -> bool
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>
Sourcepub fn domain_record_version_evidence_exists(
&self,
reference: &DomainRecordVersionRef,
) -> bool
pub fn domain_record_version_evidence_exists( &self, reference: &DomainRecordVersionRef, ) -> bool
Returns whether an exact domain-record version exists in current or retained evidence.
Sourcepub fn evidence_exists(&self, reference: &EvidenceRef) -> bool
pub fn evidence_exists(&self, reference: &EvidenceRef) -> bool
Returns whether a generic evidence identity is retained or archived.
Sourcepub fn evidence_time(&self, reference: &EvidenceRef) -> Option<SimTime>
pub fn evidence_time(&self, reference: &EvidenceRef) -> Option<SimTime>
Returns when retained evidence first became authoritative.
None means the evidence is missing or only its compact archive
receipt remains. Proposed same-boundary evidence is available through
SimulationView::evidence_time while its boundary is being built.
Sourcepub fn domain_record_version(
&self,
reference: &DomainRecordVersionRef,
) -> Option<DomainRecord>
pub fn domain_record_version( &self, reference: &DomainRecordVersionRef, ) -> Option<DomainRecord>
Resolves the retained record body for one exact domain-record version.
Returns None when the version is unavailable or only its compacted
archive receipt remains.
pub fn typed_domain_record<T: DomainRecordType>( &self, reference: &TypedDomainRecordRef<T>, ) -> Option<&DomainRecord>
pub fn domain_records(&self) -> impl Iterator<Item = &DomainRecord>
Sourcepub fn domain_record_page(
&self,
kind: &DomainRecordKind,
after: Option<&DomainRecordRef>,
limit: usize,
expected_revision: Option<u64>,
) -> Result<DomainRecordPage, CanwuError>
pub fn domain_record_page( &self, kind: &DomainRecordKind, after: Option<&DomainRecordRef>, limit: usize, expected_revision: Option<u64>, ) -> Result<DomainRecordPage, CanwuError>
Returns one revision-bound page of authoritative domain records.
Pass the revision returned by the first page on every subsequent page. A mutation between pages is rejected instead of mixing two read cuts.
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.
Sourcepub fn replay_journal(&self) -> ReplayJournal
pub fn replay_journal(&self) -> ReplayJournal
§Panics
Panics only if a runtime object was constructed without its required Format 6 initial scenario, which is prevented by the public loaders.
Sourcepub fn outbox_entries(&self) -> Result<Vec<OutboxEntry>, CanwuError>
pub fn outbox_entries(&self) -> Result<Vec<OutboxEntry>, CanwuError>
Returns the durable external-delivery outbox derived from committed boundary emissions. Entries are deterministic and never re-sent by exact replay; the host owns delivery retries and acknowledgement.