Skip to main content

TextContinuationSnapshot

Struct TextContinuationSnapshot 

Source
pub struct TextContinuationSnapshot<B: TextSnapshotBackend, C: TokenFilterController> { /* private fields */ }
Expand description

Opaque reusable model/sampler/input/controller/capture checkpoint. The facade pairs this with its semantic/output/lifecycle checkpoint before exposing a full generation snapshot. Native state is never serialized or shallow-cloned.

Implementations§

Source§

impl<B: TextSnapshotBackend, C: SnapshotTokenController> TextContinuationSnapshot<B, C>

Source

pub fn retained_bytes(&self) -> u64

Logical reservation retained by this snapshot, including facade host data.

Source

pub fn next_prediction(&self) -> u64

Absolute next decision represented by this reusable snapshot.

Source

pub fn controller(&self) -> &C

Immutable canonical constraint state for facade-specific growth facts.

Source

pub fn capture_checkpoint(&self) -> Option<&CaptureCheckpoint>

Retained source admission/accounting provenance for facade lineage.

Source

pub fn native_continuation_growth( &self, runtime: &ModelRuntime<B>, max_predictions: u64, ) -> Result<u64, TextSnapshotError<B::Error>>

Native model, sampler and pending-input growth through an absolute child decision limit. Facade/controller growth is separate and must also be reserved before publishing a runnable child. No copy or prediction occurs.

Source

pub fn capture( boundary: &mut TextContinuationBoundary<'_, '_, B, C>, budget: &SnapshotBudget, host_bytes: Option<u64>, ) -> Result<Self, TextSnapshotError<B::Error>>

Saves a complete ordinary continuation after reserving native, portable capture and caller-owned host state. host_bytes covers facade semantic/ output checkpoint storage; the controller supplies its own known estimate.

Source

pub fn restore( &self, boundary: &mut TextContinuationBoundary<'_, '_, B, C>, budget: &SnapshotBudget, ) -> Result<(), TextSnapshotError<B::Error>>

Restores the same run. All compatibility checks and independent copies precede installation. Native exchange, prepared capture commit and host replacement then perform no fallible native work or fresh sampling. Cumulative capture and copy usage are never restored from old values.

Source

pub fn restore_with<H>( &self, boundary: &mut TextContinuationBoundary<'_, '_, B, C>, budget: &SnapshotBudget, prepare_host: impl FnOnce() -> Result<H, String>, ) -> Result<H, TextSnapshotError<B::Error>>

Stages the facade’s semantic/cursor copy within the complete reservation, before any native installation. prepare_host must preserve its source; its cost must have been included in the snapshot’s host_bytes. The returned host state is installed infallibly by the owning composition.

Source

pub fn fork( &self, boundary: &mut TextContinuationBoundary<'_, '_, B, C>, budget: &SnapshotBudget, request: TextBranchRequest<'_>, ) -> Result<TextContinuationBranch<B, C>, TextSnapshotError<B::Error>>

Copies an isolated child and re-admits its shared record owner using actual backend discovery/estimator facts. It is initially inactive; no model input is replayed and no original run accounting is reset.

Source

pub fn fork_with<H>( &self, boundary: &mut TextContinuationBoundary<'_, '_, B, C>, budget: &SnapshotBudget, request: TextBranchRequest<'_>, prepare: impl FnOnce(&mut ModelRuntime<B>, &mut B::TextGenerationState) -> Result<H, TextSnapshotError<B::Error>>, ) -> Result<(TextContinuationBranch<B, C>, H), TextSnapshotError<B::Error>>

Stages complete facade state and optional prospective sampler changes under the branch reservation. Preparation receives the independently copied child sampler and re-admitted capture owner; it cannot replace the installed parent continuation. On failure no runnable child is published.

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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.