Skip to main content

Simulation

Struct Simulation 

Source
pub struct Simulation { /* private fields */ }

Implementations§

Source§

impl Simulation

Source

pub const fn decision_state(&self) -> &DecisionState

Source

pub fn decision_ticket(&self, id: DecisionTicketId) -> Option<&DecisionTicket>

Source

pub fn decision_traces(&self) -> &[DecisionTrace]

Source

pub fn decision_attempts(&self) -> &[DecisionAttemptRecord]

Source

pub fn prepare_decision( &self, decision_request_id: DecisionRequestId, command_request_id: Option<CommandRequestId>, ticket_id: DecisionTicketId, policy: &dyn DecisionPolicy, ) -> Result<DecisionEvaluation, CanwuError>

Source

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>

Source

pub fn enqueue_decision( &mut self, due_at: SimTime, priority: i32, request: DecisionIngressRequest, ) -> Result<IngressReceipt, CanwuError>

Source

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

Source§

impl Simulation

Source

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.

Source

pub fn evidence_cursor(&self) -> Result<EvidenceCursor, CanwuError>

Returns the current monotonic cut through every append-only journal.

Source

pub fn checkpoint(&self) -> Result<SimulationCheckpoint, CanwuError>

Captures current authoritative state without cloning accumulated evidence.

Source

pub fn journal_segment_since( &self, start: EvidenceCursor, ) -> Result<EvidenceJournalSegment, CanwuError>

Clones only evidence appended after a previously persisted cursor.

Source

pub fn checkpoint_journal(&self) -> Result<CheckpointJournal, CanwuError>

Builds a portable full-save bundle with one segment from genesis.

Source

pub fn checkpoint_journal_json(&self) -> Result<String, CanwuError>

Serializes the portable full-save checkpoint-journal bundle as JSON.

Source

pub fn from_checkpoint_and_journal( checkpoint: SimulationCheckpoint, segments: Vec<EvidenceJournalSegment>, ) -> Result<Self, CanwuError>

Restores a checkpoint after proving a contiguous journal prefix.

Source

pub fn from_checkpoint_journal( bundle: CheckpointJournal, ) -> Result<Self, CanwuError>

Restores a portable checkpoint-journal bundle.

Source

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.

Source

pub fn from_checkpoint_journal_json(json: &str) -> Result<Self, CanwuError>

Deserializes and restores a portable checkpoint-journal JSON bundle.

Source

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

Source

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.

Source

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

Source

pub fn advance( &mut self, duration: SimDuration, ) -> Result<Vec<SimEvent>, CanwuError>

Source

pub fn step(&mut self) -> Result<Vec<SimEvent>, CanwuError>

Source

pub fn advance_until<F>( &mut self, maximum: SimDuration, condition: F, ) -> Result<Vec<SimEvent>, CanwuError>
where F: FnMut(&Self) -> bool,

Source§

impl Simulation

Source§

impl Simulation

Source

pub fn new(seed: u64, scenario: Scenario) -> Result<Self, CanwuError>

Creates a simulation after validating that scenario references are sound.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn demo(seed: u64) -> Result<(Self, DemoIds), CanwuError>

Source

pub fn register_plugin<P: SimulationPlugin + ?Sized>( &mut self, plugin: &P, ) -> Result<(), CanwuError>

Source

pub const fn time(&self) -> SimTime

Source

pub const fn run_manifest(&self) -> &RunManifest

Source

pub const fn run_configuration(&self) -> &RunConfigurationSnapshot

Source

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.

Source

pub fn run_manifest_hash(&self) -> &str

Source

pub fn checkpoint_hash(&self) -> &str

Source

pub fn authoritative_state_hash(&self) -> Result<String, CanwuError>

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.

Source

pub fn entities(&self) -> impl Iterator<Item = &EntityRef>

Source

pub fn entity_exists(&self, entity: &EntityRef) -> bool

Source

pub fn world(&self) -> WorldSnapshot

Source

pub fn knowledge(&self) -> &KnowledgeSnapshot

Source

pub fn events(&self) -> &[SimEvent]

Source

pub fn command_log(&self) -> &[CommandRecord]

Source

pub fn command_attempts(&self) -> &[CommandAttemptRecord]

Source

pub fn ingress_log(&self) -> &[IngressRecord]

Source

pub fn domain_record( &self, reference: &DomainRecordRef, ) -> Option<&DomainRecord>

Source

pub fn domain_record_version_evidence_exists( &self, reference: &DomainRecordVersionRef, ) -> bool

Returns whether an exact domain-record version exists in current or retained evidence.

Source

pub fn evidence_exists(&self, reference: &EvidenceRef) -> bool

Returns whether a generic evidence identity is retained or archived.

Source

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.

Source

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.

Source

pub fn typed_domain_record<T: DomainRecordType>( &self, reference: &TypedDomainRecordRef<T>, ) -> Option<&DomainRecord>

Source

pub fn domain_records(&self) -> impl Iterator<Item = &DomainRecord>

Source

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.

Source

pub fn boundaries(&self) -> &[BoundaryRecord]

Source

pub fn random_draws(&self) -> &[RandomDrawRecord]

Source

pub fn boundary_head_hash(&self) -> Option<&str>

Source

pub const fn schema(&self) -> &SchemaRegistry

Source

pub fn plugin_descriptors(&self) -> impl Iterator<Item = &PluginDescriptor>

Source

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.

Source

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.

Source

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.

Source

pub fn snapshot(&self) -> SimulationSnapshot

Source

pub fn snapshot_json(&self) -> Result<String, CanwuError>

Source

pub fn from_snapshot(snapshot: SimulationSnapshot) -> Result<Self, CanwuError>

Source

pub fn from_snapshot_json(json: &str) -> Result<Self, CanwuError>

Source

pub fn from_snapshot_with_plugins( snapshot: SimulationSnapshot, plugins: &[&dyn SimulationPlugin], ) -> Result<Self, CanwuError>

Source

pub fn from_snapshot_json_with_plugins( json: &str, plugins: &[&dyn SimulationPlugin], ) -> Result<Self, CanwuError>

Source

pub fn fork(&self) -> Self

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.