pub struct IndexWorkControl { /* private fields */ }Expand description
Shared cancellation and deadline boundary for one indexing operation.
Implementations§
Source§impl IndexWorkControl
impl IndexWorkControl
Sourcepub fn new(cancellation: IndexCancellation, timeout: Option<Duration>) -> Self
pub fn new(cancellation: IndexCancellation, timeout: Option<Duration>) -> Self
Create a work boundary with an optional timeout from one shared start.
Sourcepub fn with_deadline(cancellation: IndexCancellation, deadline: Instant) -> Self
pub fn with_deadline(cancellation: IndexCancellation, deadline: Instant) -> Self
Create a work boundary with a caller-selected absolute deadline.
Sourcepub fn started_at(&self) -> Instant
pub fn started_at(&self) -> Instant
Return the common start instant for this operation.
Sourcepub fn deadline(&self) -> Option<Instant>
pub fn deadline(&self) -> Option<Instant>
Return the common absolute deadline, when configured.
Sourcepub fn worker_ceiling(&self) -> Option<usize>
pub fn worker_ceiling(&self) -> Option<usize>
Return the maximum workers available to each operation stage, when bounded.
Sourcepub fn with_worker_ceiling(&self, max_workers: usize) -> Self
pub fn with_worker_ceiling(&self, max_workers: usize) -> Self
Clone this boundary while applying a worker ceiling to every operation stage.
Sourcepub fn with_timeout_ceiling(&self, timeout: Duration) -> Self
pub fn with_timeout_ceiling(&self, timeout: Duration) -> Self
Clone this boundary while applying a maximum duration from its original start.
Sourcepub fn consume_purpose_bytes(
&self,
limit: u64,
bytes: u64,
) -> Result<u64, IndexWorkFailure>
pub fn consume_purpose_bytes( &self, limit: u64, bytes: u64, ) -> Result<u64, IndexWorkFailure>
Consume authored-purpose bytes from this operation’s aggregate budget.
§Errors
Returns IndexWorkFailure::ResourceLimitExceeded when this read and
every prior read through a clone would exceed limit.
Sourcepub const fn cancellation(&self) -> &IndexCancellation
pub const fn cancellation(&self) -> &IndexCancellation
Borrow the exact cancellation signal shared by every operation worker.
Sourcepub fn check(&self, stage: IndexWorkStage) -> Result<(), IndexWorkFailure>
pub fn check(&self, stage: IndexWorkStage) -> Result<(), IndexWorkFailure>
Check cancellation and deadline state at one typed work stage.
§Errors
Returns IndexWorkFailure::Cancelled when cancellation was requested,
or IndexWorkFailure::DeadlineExceeded when the deadline elapsed.
Trait Implementations§
Source§impl Clone for IndexWorkControl
impl Clone for IndexWorkControl
Source§fn clone(&self) -> IndexWorkControl
fn clone(&self) -> IndexWorkControl
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more