Skip to main content

PrefetchExecutionState

Struct PrefetchExecutionState 

Source
pub struct PrefetchExecutionState<E> { /* private fields */ }
Expand description

Backend-neutral bounded prefetch admission and execution lifecycle.

The backend owns workers, buffers, I/O, and completion primitives. This value is the sole owner of FIFO ordering, bounded admission, duplicate coalescing, exact operation generations, cancellation fencing, failure retention and recovery, and lifecycle telemetry.

Implementations§

Source§

impl<E> PrefetchExecutionState<E>

Source

pub fn new(queue_capacity: usize) -> Result<Self, PrefetchStateError>

Creates an empty executor state with a finite, nonzero queue capacity.

Source

pub fn admit(&mut self, id: OffloadUnitId, resident: bool) -> PrefetchAdmission

Admits a missing unit, coalesces existing work, or reports backpressure.

resident is supplied by the backend after checking its concrete storage. A completed logical result that is no longer resident is counted as evicted-before-use and is eligible for a new attempt.

Source

pub fn rollback_admission( &mut self, work: &PrefetchWork, ) -> Result<(), PrefetchStateError>

Rolls back one admitted operation whose backend notification failed.

Source

pub fn begin_next(&mut self) -> Option<PrefetchWork>

Selects the oldest admitted operation for backend submission.

Source

pub fn complete( &mut self, work: PrefetchWork, result: Result<(), E>, ) -> Result<PrefetchCompletion, PrefetchStateError>

Applies one exact backend completion.

Source

pub fn observe_demand( &mut self, id: &OffloadUnitId, ) -> PrefetchDemandObservation

Observes current background ownership when demand first arrives.

Source

pub fn is_pending(&self, id: &OffloadUnitId) -> bool

Whether an admitted or submitted operation still owns this unit.

Source

pub fn resolve_demand( &mut self, id: &OffloadUnitId, waited: Option<Duration>, ) -> Result<PrefetchDemandResolution<E>, PrefetchStateError>

Consumes the terminal background result for one demand acquisition.

Source

pub fn begin_backpressure(&mut self)

Records a submission when it first encounters bounded admission capacity.

Source

pub fn finish_backpressure(&mut self, duration: Duration)

Records how long one backpressured submission waited before resolving.

Source

pub fn cancel_all(&mut self) -> Result<(), PrefetchStateError>

Cancels all queued work immediately and fences exact in-flight work.

In-flight backend resources remain owned until Self::complete sees their exact operation. Queued work needs no backend cancellation and is discarded synchronously.

Source

pub fn finish_cancellation( &mut self, ) -> Result<Option<(OffloadUnitId, E)>, PrefetchStateError>

Finishes cancellation after every exact in-flight operation resolved.

Completed prefetches are abandoned. The first retained backend failure is returned in deterministic logical-unit order.

Source

pub fn is_idle(&self) -> bool

Whether no admitted or backend-submitted operation remains.

Source

pub const fn generation(&self) -> u64

Current cancellation generation.

Source

pub const fn report(&self) -> BackgroundPrefetchReport

Immutable telemetry snapshot.

Trait Implementations§

Source§

impl<E: Debug> Debug for PrefetchExecutionState<E>

Source§

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

Formats the value using the given formatter. 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<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, <T as TryFrom<U>>::Error>

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.