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 journal_segment_since(
&self,
start: EvidenceCursor,
) -> Result<EvidenceJournalSegment, CanwuError>
pub fn journal_segment_since( &self, start: EvidenceCursor, ) -> Result<EvidenceJournalSegment, CanwuError>
Clones the retained evidence tail after start. Caller-owned sealed
prefixes must be supplied separately when restoring the checkpoint.
Sourcepub fn prepare_paged_checkpoint(
&self,
source: Option<&PagedSimulationCheckpoint>,
provider: &dyn StatePageProvider,
) -> Result<PreparedPagedSimulationCheckpoint, CanwuError>
pub fn prepare_paged_checkpoint( &self, source: Option<&PagedSimulationCheckpoint>, provider: &dyn StatePageProvider, ) -> Result<PreparedPagedSimulationCheckpoint, CanwuError>
Prepares an incremental content-addressed checkpoint for the compact runtime without rehydrating archived evidence or decision payloads.
Sourcepub fn boundaries(&self) -> &[BoundaryRecord]
pub fn boundaries(&self) -> &[BoundaryRecord]
Returns the retained canonical boundary tail. Sealed prefixes remain caller-owned evidence segments and are intentionally not rehydrated.
Sourcepub fn outbox_entries(&self) -> Result<Vec<OutboxEntry>, CanwuError>
pub fn outbox_entries(&self) -> Result<Vec<OutboxEntry>, CanwuError>
Returns stable identities for committed boundary emissions still retained by this compact runtime. Sealed prefixes remain owned by the caller as archive segments and can be replayed from those segments.
Sourcepub fn outbox_entries_for_segment(
&self,
segment: &EvidenceJournalSegment,
) -> Result<Vec<OutboxEntry>, CanwuError>
pub fn outbox_entries_for_segment( &self, segment: &EvidenceJournalSegment, ) -> Result<Vec<OutboxEntry>, CanwuError>
Reconstructs durable delivery identities for a caller-owned sealed evidence segment. Sealing does not remove these identities; the caller can retain the segment and regenerate the same at-least-once delivery keys after restart.
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 prepare_decision_archive(
&self,
keys: &[DecisionHistoryKey],
) -> Result<PreparedDecisionArchive, CanwuError>
pub fn prepare_decision_archive( &self, keys: &[DecisionHistoryKey], ) -> Result<PreparedDecisionArchive, CanwuError>
Prepares a bounded terminal decision-history archive without mutating the authoritative checkpoint. The returned blobs must be stored and read back through the provider before commit.
Sourcepub fn commit_decision_archive(
&mut self,
prepared: &PreparedDecisionArchive,
provider: &dyn DecisionArchiveProvider,
) -> Result<IngressReceipt, CanwuError>
pub fn commit_decision_archive( &mut self, prepared: &PreparedDecisionArchive, provider: &dyn DecisionArchiveProvider, ) -> Result<IngressReceipt, CanwuError>
Verifies stored terminal decision payloads and queues the compact receipt transition as canonical maintenance ingress. Hot payloads are released only when that ingress is admitted at a normal boundary, so replay reproduces the same archive transition and checkpoint root.
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 entities(&self) -> impl Iterator<Item = &EntityRef>
pub fn entity_exists(&self, entity: &EntityRef) -> bool
pub fn world(&self) -> WorldSnapshot
Sourcepub fn person_availability(
&self,
person: PersonId,
) -> Option<&PersonAvailability>
pub fn person_availability( &self, person: PersonId, ) -> Option<&PersonAvailability>
Returns committed availability for a person. None means alive and free.
Sourcepub fn person_availabilities(
&self,
) -> impl Iterator<Item = (&PersonId, &PersonAvailability)>
pub fn person_availabilities( &self, ) -> impl Iterator<Item = (&PersonId, &PersonAvailability)>
Returns every committed person availability in person-ID order.
pub fn knowledge(&self) -> &KnowledgeSnapshot
pub fn domain_record( &self, reference: &DomainRecordRef, ) -> Option<&DomainRecord>
pub fn decision_ticket(&self, id: DecisionTicketId) -> Option<&DecisionTicket>
pub fn decision_controller( &self, id: &str, ) -> Option<&DecisionControllerBinding>
pub fn decision_trace(&self, id: DecisionTraceId) -> Option<&DecisionTrace>
pub fn decision_attempt( &self, id: DecisionRequestId, ) -> Option<&DecisionAttemptRecord>
pub fn decision_hot_state(&self) -> DecisionHotState
pub fn decision_history_location( &self, key: &DecisionHistoryKey, ) -> DecisionHistoryLocation
pub fn decision_history_location_with_provider( &self, key: &DecisionHistoryKey, provider: &dyn DecisionArchiveProvider, ) -> Result<DecisionHistoryLocation, CanwuError>
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 enqueue_permitted_plugin_ingress( &mut self, request: PluginIngressRequest, permit: &PluginIngressPermit, ) -> Result<IngressReceipt, CanwuError>
Sourcepub fn cancel_plugin_ingress(
&mut self,
ingress_id: IngressId,
reason: impl Into<String>,
) -> Result<IngressReceipt, CanwuError>
pub fn cancel_plugin_ingress( &mut self, ingress_id: IngressId, reason: impl Into<String>, ) -> Result<IngressReceipt, CanwuError>
Sourcepub fn cancel_permitted_plugin_ingress(
&mut self,
ingress_id: IngressId,
permit: &PluginIngressPermit,
reason: impl Into<String>,
) -> Result<IngressReceipt, CanwuError>
pub fn cancel_permitted_plugin_ingress( &mut self, ingress_id: IngressId, permit: &PluginIngressPermit, reason: impl Into<String>, ) -> 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.