Engine

Struct Engine 

Source
pub struct Engine<P: TextProfile, const SLOTS: usize = 4, const PAGES: usize = 24> { /* private fields */ }
Expand description

The deterministic text engine.

SLOTS/PAGES size the shared reassembly pool (a page is 80 bytes; a full 160-byte fragment consumes two pages).

Implementations§

Source§

impl<P: TextProfile, const SLOTS: usize, const PAGES: usize> Engine<P, SLOTS, PAGES>

Source

pub fn new( profile: P, local_key: PublicKey, config: EngineConfig, jitter_seed: u64, ) -> Self

jitter_seed drives group-repair desynchronization only; it is scheduling randomness, not security material.

Source

pub fn poll_output(&mut self) -> Option<Output>

Drain the next output. The render arena resets when this returns None, invalidating previously returned BodyRefs.

Source

pub fn set_local_handle(&mut self, handle: &str)

Set the display name carried on our own group messages.

Truncated to the wire limit on a character boundary. An empty name clears it, and group messages then go out unnamed — recipients see only the claimed hint.

Source

pub fn body(&self, body: &BodyRef) -> &str

Resolve a BodyRef to its UTF-8 text.

Source

pub fn lost_outputs(&self) -> u32

Outputs dropped because the queue overflowed (platform drained too slowly). Nonzero values warrant a resync from persistent storage.

Source

pub fn restore(&mut self, checkpoints: &[StreamCheckpoint], _now_ms: u64)

Seed outbound stream continuity from persisted checkpoints. Restored conversations resume their sequence at first use.

Continuity is tracked in memory for 8 active plus 24 cold conversations. Pass checkpoints oldest-first: when more are supplied than the cold stash holds, the earliest entries are the ones displaced. A conversation without retained continuity (never restored, or displaced past the bound) starts a fresh epoch and announces a lazy Sequence Reset — safe by design, at the cost of receivers re-baselining that stream.

Source

pub fn compose( &mut self, conversation: ConversationKey, client_token: u32, intent: ComposeIntent<'_>, now_ms: u64, ) -> Result<MessageHandle, ComposeError>

Compose and queue an outbound message. Returns the stable handle of the affected transcript record.

Source

pub fn receive( &mut self, envelope: &Envelope, sender_full_key: Option<PublicKey>, payload: &[u8], now_ms: u64, ) -> Result<(), ReceiveError>

Feed one MAC-validated received text payload (without the payload-type byte) through the engine.

sender_full_key resolves a claimed multicast member to a full public key when the platform knows it; it is required for that sender’s streams to be repairable.

Source

pub fn transmit_update( &mut self, transmission_id: u32, state: DeliveryState, now_ms: u64, )

Report transport progress for a previously emitted transmission.

Source

pub fn archive_result( &mut self, request_id: u32, result: ArchiveResult<'_>, now_ms: u64, )

Answer a previously emitted LookupOutbound effect.

Source

pub fn tick(&mut self, now_ms: u64)

Advance timers: reassembly expiry, notify deadlines, repair scheduling.

Auto Trait Implementations§

§

impl<P, const SLOTS: usize, const PAGES: usize> Freeze for Engine<P, SLOTS, PAGES>
where P: Freeze,

§

impl<P, const SLOTS: usize, const PAGES: usize> RefUnwindSafe for Engine<P, SLOTS, PAGES>
where P: RefUnwindSafe,

§

impl<P, const SLOTS: usize, const PAGES: usize> Send for Engine<P, SLOTS, PAGES>
where P: Send,

§

impl<P, const SLOTS: usize, const PAGES: usize> Sync for Engine<P, SLOTS, PAGES>
where P: Sync,

§

impl<P, const SLOTS: usize, const PAGES: usize> Unpin for Engine<P, SLOTS, PAGES>
where P: Unpin,

§

impl<P, const SLOTS: usize, const PAGES: usize> UnwindSafe for Engine<P, SLOTS, PAGES>
where P: UnwindSafe,

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

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
§

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

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

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

§

type Error = <U as TryFrom<T>>::Error

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

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.