Skip to main content

CaptureSession

Struct CaptureSession 

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

A run owns one ledger and at most one step of host records. Consumers must drain each step before another is started; there is no producer queue.

Implementations§

Source§

impl CaptureSession

Source

pub fn checkpoint_storage_bytes( &self, discovery: &CaptureDiscovery, ) -> Option<u64>

Known logical host storage for a copied portable checkpoint. Includes all admitted plan payloads and declarations, but no native estimator or handle. Callers reserve this before checkpoint clones the admission data.

Source

pub fn checkpoint( &self, discovery: &CaptureDiscovery, ) -> Result<CaptureCheckpoint, CaptureError>

Saves portable schedule position only after the current records have been delivered and all intervention finish checks succeeded. The initial run is also a valid boundary. The caller supplies retained loaded discovery.

Source

pub fn validate_restore( &self, checkpoint: &CaptureCheckpoint, ) -> Result<(), CaptureError>

Checks a same-run restore before any native or portable mutation. Undelivered records must be consumed even when the previous operation failed.

Source

pub fn restore( &mut self, checkpoint: &CaptureCheckpoint, ) -> Result<(), CaptureError>

Rewinds schedule state without refunding any consumed resource or publishing old records again. Native restoration must succeed before this is committed.

Source

pub fn prepare_restore( &mut self, checkpoint: &CaptureCheckpoint, ) -> Result<PreparedCaptureRestore<'_>, CaptureError>

Validates restoration while exclusively borrowing the run until commit.

Source

pub fn cumulative_usage(&self) -> CaptureUsage

Cumulative usage of this run, including the explicitly inherited child base.

Source§

impl CaptureSession

Source

pub fn new(plan: AdmittedCapturePlan) -> Self

Creates an unstarted capture run owning its admission and ledger.

Source

pub fn plan(&self) -> &AdmittedCapturePlan

Borrows this run’s immutable admission.

Source

pub fn intervention_plan(&self) -> Option<&AdmittedInterventionPlan>

Immutable intervention admission currently paired with this shared owner.

Source

pub fn begin_step( &mut self, phase: CapturePhase, prediction: u64, ) -> Result<(), CaptureError>

Reserves diagnostic envelopes before execution, including scheduled skips and missing values. Exhaustion here fails the step: emitting an unaccounted skip record would itself violate the export limit.

Source

pub fn observe<B: CaptureBackend>( &mut self, backend: &mut B, path: &str, tensor: &B::Tensor, ) -> Result<(), CaptureExecutionError<B::Error>>

Invoked while the architecture borrows a tensor. A skipped point never calls the native transform and never clones a native tensor handle.

Source

pub fn take_step(&mut self) -> Option<CapturedStep>

Moves the current bounded record batch to the consumer.

Source§

impl CaptureSession

Source

pub fn enable_interventions( &mut self, plan: AdmittedInterventionPlan, estimator: Arc<dyn InterventionEstimator>, ) -> Result<(), CaptureError>

Installs an immutable intervention plan before the first step. Both plans share one ledger; capture-none budgets must still allow outcome metadata.

Source

pub fn intervene<B: InterventionBackend>( &mut self, backend: &mut B, path: &str, tensor: &B::Tensor, ) -> Result<Option<B::Tensor>, CaptureExecutionError<B::Error>>

Applies scheduled activation operations in plan order. Ordinary observation must precede this call at the exact same hook. Returns no replacement when no operation is active, avoiding source cloning and native materialization.

Source

pub fn finish_interventions(&self) -> Result<(), CaptureError>

Checks scheduled targets before committing a prediction. Missing targets are preserved in records and fail the attempt; this does not establish rollback.

Source§

impl CaptureSession

Source

pub fn routing_control( &mut self, path: &str, token_rows: u64, ) -> Result<Option<GroupSelectionControl>, CaptureError>

Validates a scheduled routing operation against actual flattened token rows and reserves any original-decision work before the selector runs.

Source

pub fn routing_applied<B: CaptureBackend>( &mut self, backend: &mut B, path: &str, original: Option<RoutingDecision<'_, B::Tensor>>, effective: RoutingDecision<'_, B::Tensor>, ) -> Result<(), CaptureExecutionError<B::Error>>

Captures attributed IDs/coefficients before the expert provider runs.

Source

pub fn routing_failed(&mut self, path: &str, message: &str)

Retains a bounded selector failure without treating it as proof of rollback.

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.