pub struct BlockingDrainLease { /* private fields */ }Expand description
A bounded authority for I/O required by an operation already accepted by a service scope.
A lease is created while its scope is open. It may then be used during that scope’s shutdown, but only until its original deadline or an earlier shutdown deadline installed on that scope, and only for its reserved number of submissions. It is deliberately not cloneable: moving it preserves one shared, non-expandable allowance.
Implementations§
Source§impl BlockingDrainLease
impl BlockingDrainLease
Sourcepub fn spawn_io<F, R>(
&self,
name: impl Into<Arc<str>>,
operation: F,
) -> impl Future<Output = RuntimeResult<R>> + Send + '_
pub fn spawn_io<F, R>( &self, name: impl Into<Arc<str>>, operation: F, ) -> impl Future<Output = RuntimeResult<R>> + Send + '_
Runs one short I/O operation under this lease.
The existing lane capacity and deadline policy still apply. A running closure retains its execution permit until it exits. This does not reopen the scope’s ordinary admission.
Sourcepub fn spawn_io_until<F, R>(
&self,
name: impl Into<Arc<str>>,
deadline: ShutdownDeadline,
operation: F,
) -> impl Future<Output = RuntimeResult<R>> + Send + '_
pub fn spawn_io_until<F, R>( &self, name: impl Into<Arc<str>>, deadline: ShutdownDeadline, operation: F, ) -> impl Future<Output = RuntimeResult<R>> + Send + '_
Runs one short I/O operation without extending this lease’s deadline.
Sourcepub fn remaining_operations(&self) -> usize
pub fn remaining_operations(&self) -> usize
Returns the number of submissions that this lease can still admit.