pub struct CacheIoExecutionState { /* private fields */ }Expand description
Canonical admission and cancellation state for a bounded cache I/O worker.
Backends own task payloads, worker threads, files, buffers, and completion objects. This state owns exact-key coalescing, bounded admission, queued and in-flight cancellation, and peak queue accounting.
Implementations§
Source§impl CacheIoExecutionState
impl CacheIoExecutionState
Sourcepub fn new(capacity: usize) -> Result<Self, CacheIoExecutionStateError>
pub fn new(capacity: usize) -> Result<Self, CacheIoExecutionStateError>
Creates an empty state with finite nonzero queue capacity.
Sourcepub fn prepare(&mut self, key: CacheIoOperationKey) -> CacheIoPreparation
pub fn prepare(&mut self, key: CacheIoOperationKey) -> CacheIoPreparation
Registers an exact key or joins its existing completion owner.
Sourcepub fn admit(
&mut self,
key: &CacheIoOperationKey,
) -> Result<CacheIoAdmission, CacheIoExecutionStateError>
pub fn admit( &mut self, key: &CacheIoOperationKey, ) -> Result<CacheIoAdmission, CacheIoExecutionStateError>
Attempts to admit one previously prepared operation.
Sourcepub fn rollback_admission(
&mut self,
key: &CacheIoOperationKey,
) -> Result<(), CacheIoExecutionStateError>
pub fn rollback_admission( &mut self, key: &CacheIoOperationKey, ) -> Result<(), CacheIoExecutionStateError>
Rolls back physical enqueue failure without losing exact-key ownership.
Sourcepub fn begin(
&mut self,
key: &CacheIoOperationKey,
) -> Result<CacheIoStartDisposition, CacheIoExecutionStateError>
pub fn begin( &mut self, key: &CacheIoOperationKey, ) -> Result<CacheIoStartDisposition, CacheIoExecutionStateError>
Begins one operation received by the physical executor.
Sourcepub fn cancel(&mut self, key: &CacheIoOperationKey) -> bool
pub fn cancel(&mut self, key: &CacheIoOperationKey) -> bool
Cancels prepared, queued, or physically executing work exactly once.
Sourcepub fn complete(
&mut self,
key: &CacheIoOperationKey,
) -> Result<CacheIoCompletionDisposition, CacheIoExecutionStateError>
pub fn complete( &mut self, key: &CacheIoOperationKey, ) -> Result<CacheIoCompletionDisposition, CacheIoExecutionStateError>
Resolves one exact physically executed operation.
Sourcepub fn retire(
&mut self,
key: &CacheIoOperationKey,
) -> Result<bool, CacheIoExecutionStateError>
pub fn retire( &mut self, key: &CacheIoOperationKey, ) -> Result<bool, CacheIoExecutionStateError>
Releases exact-key ownership after task resources are safe to drop.
Sourcepub const fn peak_queued(&self) -> usize
pub const fn peak_queued(&self) -> usize
Largest physically queued operation count.