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 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.

Source

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.

Source

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

Returns the retained canonical boundary tail. Sealed prefixes remain caller-owned evidence segments and are intentionally not rehydrated.

Source

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.

Source

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.

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 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.

Source

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.

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 entities(&self) -> impl Iterator<Item = &EntityRef>

Source

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

Source

pub fn world(&self) -> WorldSnapshot

Source

pub fn person_availability( &self, person: PersonId, ) -> Option<&PersonAvailability>

Returns committed availability for a person. None means alive and free.

Source

pub fn person_availabilities( &self, ) -> impl Iterator<Item = (&PersonId, &PersonAvailability)>

Returns every committed person availability in person-ID order.

Source

pub fn pending_transition_manifests( &self, ) -> impl Iterator<Item = &PendingTransitionManifest>

Returns the registered transition manifests whose ready boundary has not settled, in manifest-ID order.

Source

pub fn knowledge(&self) -> &KnowledgeSnapshot

Source

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

Source

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

Source

pub fn decision_controller( &self, id: &str, ) -> Option<&DecisionControllerBinding>

Source

pub fn decision_trace(&self, id: DecisionTraceId) -> Option<&DecisionTrace>

Source

pub fn decision_attempt( &self, id: DecisionRequestId, ) -> Option<&DecisionAttemptRecord>

Source

pub fn decision_hot_state(&self) -> DecisionHotState

Source

pub fn decision_history_location( &self, key: &DecisionHistoryKey, ) -> DecisionHistoryLocation

Source

pub fn decision_history_location_with_provider( &self, key: &DecisionHistoryKey, provider: &dyn DecisionArchiveProvider, ) -> Result<DecisionHistoryLocation, CanwuError>

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 enqueue_permitted_plugin_ingress( &mut self, request: PluginIngressRequest, permit: &PluginIngressPermit, ) -> Result<IngressReceipt, CanwuError>

Source

pub fn cancel_plugin_ingress( &mut self, ingress_id: IngressId, reason: impl Into<String>, ) -> Result<IngressReceipt, CanwuError>

Source

pub fn cancel_permitted_plugin_ingress( &mut self, ingress_id: IngressId, permit: &PluginIngressPermit, reason: impl Into<String>, ) -> 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> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.