Skip to main content

CompactedSimulation

Struct CompactedSimulation 

Source
pub struct CompactedSimulation { /* private fields */ }
Expand description

A live simulation whose sealed evidence prefixes are owned by the caller.

This opt-in runtime preserves current authoritative state, deterministic commitments, idempotency, and continuation behavior while retaining only the evidence appended since the most recent seal. Every returned segment is part of the permanent replay record and must be stored contiguously by the caller.

Implementations§

Source§

impl CompactedSimulation

Source

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

Returns the monotonic cut through sealed and retained evidence.

Source

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

Captures current state and the total journal cut without cloning sealed evidence.

Source

pub fn archived_evidence_receipt( &self, reference: &EvidenceRef, ) -> Option<&ArchivedEvidenceReceipt>

Returns the committed receipt for an archived evidence identity.

Source

pub fn load_archived_evidence_segment( &self, reference: &EvidenceRef, provider: &dyn ArchiveProvider, ) -> Result<EvidenceJournalSegment, CanwuError>

Loads and fully verifies the segment containing archived evidence whose payload must be inspected.

Source

pub fn seal_evidence( &mut self, ) -> Result<Option<EvidenceJournalSegment>, CanwuError>

Seals and releases the current retained evidence tail.

The runtime changes only after the segment is fully constructed and its continuation indexes are prepared. An empty retained tail returns None. The caller owns persistence and must keep all non-empty segments in exact cursor order for save restoration or replay.

Source

pub fn prepare_evidence_seal( &self, ) -> Result<Option<PreparedEvidenceSeal>, CanwuError>

Builds an immutable, content-addressed archive candidate.

The returned segment must be durably stored before Self::commit_evidence_seal is called. Preparing never changes the live simulation.

Source

pub fn commit_evidence_seal( &mut self, token: &EvidenceSealToken, provider: &dyn ArchiveProvider, ) -> Result<(), CanwuError>

Atomically commits a previously prepared segment after reading the exact stored bytes back through the archive provider.

Source

pub const fn time(&self) -> SimTime

Source

pub const fn revision(&self) -> u64

Source

pub fn checkpoint_hash(&self) -> &str

Source

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

Source

pub fn world(&self) -> WorldSnapshot

Source

pub fn knowledge(&self) -> &KnowledgeSnapshot

Source

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

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 typed_domain_record<T>( &self, reference: &TypedDomainRecordRef<T>, ) -> Option<&DomainRecord>

Source

pub fn submit( &mut self, envelope: CommandEnvelope, ) -> Result<CommandReceipt, CanwuError>

Source

pub fn process_command( &mut self, request: CommandRequest, ) -> Result<CommandOutcome, CanwuError>

Source

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

Source

pub fn enqueue_plugin_ingress( &mut self, request: PluginIngressRequest, ) -> Result<IngressReceipt, CanwuError>

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

pub fn schedule_calendar_boundary( &mut self, due_at: SimTime, cadences: Vec<SystemCadence>, ) -> Result<IngressReceipt, CanwuError>

Source

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

Source

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

Source

pub fn step_canonical(&mut self) -> Result<Option<BoundaryReceipt>, CanwuError>

Source

pub fn settle_boundary( &mut self, request: BoundaryRequest, ) -> Result<BoundaryReceipt, CanwuError>

Source

pub fn snapshot_with_segments( &self, segments: Vec<EvidenceJournalSegment>, ) -> Result<SimulationSnapshot, CanwuError>

Reconstructs a validated full snapshot from the supplied sealed prefix plus the currently retained tail.

Source

pub fn replay_journal_with_segments( &self, segments: Vec<EvidenceJournalSegment>, ) -> Result<ReplayJournal, CanwuError>

Produces the ordinary exact-replay journal after validating the supplied archive.

Source

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

Restores and validates a checkpoint plus its archive, then enters the compact interface with that evidence retained until the caller seals it.

Source

pub fn from_checkpoint_and_journal_with_plugins( checkpoint: SimulationCheckpoint, segments: Vec<EvidenceJournalSegment>, plugins: &[&dyn SimulationPlugin], ) -> Result<CompactedSimulation, CanwuError>

Restores a compact runtime and rehydrates its exact executable plugins.

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.