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
impl CompactedSimulation
Sourcepub fn evidence_cursor(&self) -> Result<EvidenceCursor, CanwuError>
pub fn evidence_cursor(&self) -> Result<EvidenceCursor, CanwuError>
Returns the monotonic cut through sealed and retained evidence.
Sourcepub fn checkpoint(&self) -> Result<SimulationCheckpoint, CanwuError>
pub fn checkpoint(&self) -> Result<SimulationCheckpoint, CanwuError>
Captures current state and the total journal cut without cloning sealed evidence.
Sourcepub fn archived_evidence_receipt(
&self,
reference: &EvidenceRef,
) -> Option<&ArchivedEvidenceReceipt>
pub fn archived_evidence_receipt( &self, reference: &EvidenceRef, ) -> Option<&ArchivedEvidenceReceipt>
Returns the committed receipt for an archived evidence identity.
Sourcepub fn load_archived_evidence_segment(
&self,
reference: &EvidenceRef,
provider: &dyn ArchiveProvider,
) -> Result<EvidenceJournalSegment, CanwuError>
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.
Sourcepub fn seal_evidence(
&mut self,
) -> Result<Option<EvidenceJournalSegment>, CanwuError>
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.
Sourcepub fn prepare_evidence_seal(
&self,
) -> Result<Option<PreparedEvidenceSeal>, CanwuError>
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.
Sourcepub fn commit_evidence_seal(
&mut self,
token: &EvidenceSealToken,
provider: &dyn ArchiveProvider,
) -> Result<(), CanwuError>
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.
pub const fn time(&self) -> SimTime
pub const fn revision(&self) -> u64
pub fn checkpoint_hash(&self) -> &str
pub fn boundary_head_hash(&self) -> Option<&str>
pub fn world(&self) -> WorldSnapshot
pub fn knowledge(&self) -> &KnowledgeSnapshot
pub fn domain_record( &self, reference: &DomainRecordRef, ) -> Option<&DomainRecord>
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 typed_domain_record<T>(
&self,
reference: &TypedDomainRecordRef<T>,
) -> Option<&DomainRecord>where
T: DomainRecordType,
pub fn submit( &mut self, envelope: CommandEnvelope, ) -> Result<CommandReceipt, CanwuError>
pub fn process_command( &mut self, request: CommandRequest, ) -> Result<CommandOutcome, 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 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>
pub fn schedule_calendar_boundary( &mut self, due_at: SimTime, cadences: Vec<SystemCadence>, ) -> Result<IngressReceipt, CanwuError>
pub fn advance( &mut self, duration: SimDuration, ) -> Result<Vec<SimEvent>, CanwuError>
pub fn advance_canonical( &mut self, duration: SimDuration, ) -> Result<Vec<BoundaryReceipt>, CanwuError>
pub fn step_canonical(&mut self) -> Result<Option<BoundaryReceipt>, CanwuError>
pub fn settle_boundary( &mut self, request: BoundaryRequest, ) -> Result<BoundaryReceipt, CanwuError>
Sourcepub fn snapshot_with_segments(
&self,
segments: Vec<EvidenceJournalSegment>,
) -> Result<SimulationSnapshot, CanwuError>
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.
Sourcepub fn replay_journal_with_segments(
&self,
segments: Vec<EvidenceJournalSegment>,
) -> Result<ReplayJournal, CanwuError>
pub fn replay_journal_with_segments( &self, segments: Vec<EvidenceJournalSegment>, ) -> Result<ReplayJournal, CanwuError>
Produces the ordinary exact-replay journal after validating the supplied archive.
Sourcepub fn from_checkpoint_and_journal(
checkpoint: SimulationCheckpoint,
segments: Vec<EvidenceJournalSegment>,
) -> Result<CompactedSimulation, CanwuError>
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.
Sourcepub fn from_checkpoint_and_journal_with_plugins(
checkpoint: SimulationCheckpoint,
segments: Vec<EvidenceJournalSegment>,
plugins: &[&dyn SimulationPlugin],
) -> Result<CompactedSimulation, CanwuError>
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.