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>
impl<B: TextSnapshotBackend, C: SnapshotTokenController> TextContinuationSnapshot<B, C>
Sourcepub fn retained_bytes(&self) -> u64
pub fn retained_bytes(&self) -> u64
Logical reservation retained by this snapshot, including facade host data.
Sourcepub fn next_prediction(&self) -> u64
pub fn next_prediction(&self) -> u64
Absolute next decision represented by this reusable snapshot.
Sourcepub fn controller(&self) -> &C
pub fn controller(&self) -> &C
Immutable canonical constraint state for facade-specific growth facts.
Sourcepub fn capture_checkpoint(&self) -> Option<&CaptureCheckpoint>
pub fn capture_checkpoint(&self) -> Option<&CaptureCheckpoint>
Retained source admission/accounting provenance for facade lineage.
Sourcepub fn native_continuation_growth(
&self,
runtime: &ModelRuntime<B>,
max_predictions: u64,
) -> Result<u64, TextSnapshotError<B::Error>>
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.
Sourcepub fn capture(
boundary: &mut TextContinuationBoundary<'_, '_, B, C>,
budget: &SnapshotBudget,
host_bytes: Option<u64>,
) -> Result<Self, TextSnapshotError<B::Error>>
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.
Sourcepub fn restore(
&self,
boundary: &mut TextContinuationBoundary<'_, '_, B, C>,
budget: &SnapshotBudget,
) -> Result<(), TextSnapshotError<B::Error>>
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.
Sourcepub fn restore_with<H>(
&self,
boundary: &mut TextContinuationBoundary<'_, '_, B, C>,
budget: &SnapshotBudget,
prepare_host: impl FnOnce() -> Result<H, String>,
) -> Result<H, TextSnapshotError<B::Error>>
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.
Sourcepub fn fork(
&self,
boundary: &mut TextContinuationBoundary<'_, '_, B, C>,
budget: &SnapshotBudget,
request: TextBranchRequest<'_>,
) -> Result<TextContinuationBranch<B, C>, TextSnapshotError<B::Error>>
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.
Sourcepub 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>>
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.