pub struct BackgroundPrefetchWorker { /* private fields */ }Expand description
One bounded background prefetch worker with exact cancellation and configurable shutdown.
Implementations§
Source§impl BackgroundPrefetchWorker
impl BackgroundPrefetchWorker
Sourcepub fn new<F>(
capacity: usize,
thread_name: impl Into<String>,
operation: F,
) -> Result<Self, BackgroundPrefetchWorkerError>
pub fn new<F>( capacity: usize, thread_name: impl Into<String>, operation: F, ) -> Result<Self, BackgroundPrefetchWorkerError>
Starts a named worker which executes one backend-owned operation at a time.
Sourcepub fn with_nonblocking_drop(self) -> Self
pub fn with_nonblocking_drop(self) -> Self
Requests shutdown without joining when this handle is dropped.
The worker retains its operation and lifecycle state until in-flight
work returns. Queued work is cancelled by that worker; callers needing
a synchronous fence can still explicitly call Self::cancel.
Sourcepub fn submit(
&self,
id: &OffloadUnitId,
resident: bool,
) -> Result<(), BackgroundPrefetchWorkerError>
pub fn submit( &self, id: &OffloadUnitId, resident: bool, ) -> Result<(), BackgroundPrefetchWorkerError>
Admits or coalesces one operation after the backend reports current residency.
Sourcepub fn wait(
&self,
id: &OffloadUnitId,
) -> Result<PrefetchDemandResolution<String>, BackgroundPrefetchWorkerError>
pub fn wait( &self, id: &OffloadUnitId, ) -> Result<PrefetchDemandResolution<String>, BackgroundPrefetchWorkerError>
Waits for background ownership to resolve and consumes its exact result.
Sourcepub fn cancel(&self) -> Result<(), BackgroundPrefetchWorkerError>
pub fn cancel(&self) -> Result<(), BackgroundPrefetchWorkerError>
Cancels queued work, fences in-flight work, and returns its first failure.
Sourcepub fn report(
&self,
) -> Result<BackgroundPrefetchReport, BackgroundPrefetchWorkerError>
pub fn report( &self, ) -> Result<BackgroundPrefetchReport, BackgroundPrefetchWorkerError>
Returns an immutable lifecycle and backpressure report.
Sourcepub fn wait_idle(&self) -> Result<(), BackgroundPrefetchWorkerError>
pub fn wait_idle(&self) -> Result<(), BackgroundPrefetchWorkerError>
Waits until all admitted work reaches a terminal state.