Skip to main content

Machine

Struct Machine 

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

In-memory reference machine for the Semantic Interpreter and Embedded profiles. All ambient I/O belongs in higher-level runtime crates.

Implementations§

Source§

impl Machine

Source

pub fn new() -> Self

Create an empty semantic machine.

Source

pub fn snapshot(&self) -> MachineSnapshot

Export canonical inputs for durable persistence.

Source

pub fn restore(snapshot: MachineSnapshot) -> Result<Self>

Restore a Machine and deterministically rebuild all projections.

Source

pub fn compact_event_history( &mut self, retain_suffix: usize, ) -> Result<MachineCompaction>

Compact a causally closed event prefix and retain a full suffix.

Source

pub fn seal_plan(&mut self, candidate: PlanCandidate) -> Result<SealedPlan>

Validate, seal, and store a Plan Candidate.

Source

pub fn insert_plan(&mut self, plan: SealedPlan) -> Result<()>

Insert and verify an already sealed plan.

Source

pub fn plan(&self, plan_id: &str) -> Option<&SealedPlan>

Read a sealed plan.

Source

pub fn put_artifact( &mut self, kind: impl Into<String>, bytes: Vec<u8>, ) -> ArtifactRef

Store immutable typed bytes and return their content reference.

Source

pub fn artifact(&self, reference: &ArtifactRef) -> Option<&ArtifactRecord>

Read an immutable artifact.

Source

pub fn remove_artifact_for_test( &mut self, artifact_id: &str, ) -> Option<ArtifactRecord>

Remove an artifact to exercise retention behavior in conformance tests.

Source

pub fn replay_availability( &self, required: &[ArtifactRef], ) -> ReplayAvailability

Classify replay capability for a required artifact set.

Source

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

Admit an idempotent command and reduce its canonical event.

Source

pub fn append_event(&mut self, event: Event) -> Result<()>

Append a trusted event after identity, parent, and transition validation.

Source

pub const fn projection(&self) -> &Projection

Current rebuildable projection.

Source

pub fn events(&self) -> impl Iterator<Item = &Event>

Events in admission order.

Source

pub fn replay(events: impl IntoIterator<Item = Event>) -> Result<Projection>

Rebuild a projection from an unordered causal event set.

Source

pub fn verify_replay(&self) -> Result<()>

Replay all current events and verify the digest matches the live projection.

Trait Implementations§

Source§

impl Clone for Machine

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Machine

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Machine

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.