pub struct RecoveryPermitter { /* private fields */ }Expand description
Bounded in-flight recovery counter.
Implementations§
Source§impl RecoveryPermitter
impl RecoveryPermitter
Sourcepub fn new(max_concurrent: usize) -> Self
pub fn new(max_concurrent: usize) -> Self
Create a permitter that allows up to max_concurrent parallel
recoveries.
Sourcepub fn available(&self) -> usize
pub fn available(&self) -> usize
Permits currently available — i.e. how many more recoveries could begin right now without blocking.
Sourcepub fn in_flight(&self) -> usize
pub fn in_flight(&self) -> usize
Permits currently held by callers (waiting on or driving a recovery).
Sourcepub async fn acquire(&self) -> Option<OwnedSemaphorePermit>
pub async fn acquire(&self) -> Option<OwnedSemaphorePermit>
Block until a permit is available.
Returns None if the permitter has been
closed, so callers can map the
result onto EventsourcedError::PermitDenied cleanly.
Sourcepub fn try_acquire(&self) -> Result<OwnedSemaphorePermit, TryAcquireError>
pub fn try_acquire(&self) -> Result<OwnedSemaphorePermit, TryAcquireError>
Try to acquire a permit without waiting. Returns Err(_) if
no permit is available right now.
Trait Implementations§
Source§impl Clone for RecoveryPermitter
impl Clone for RecoveryPermitter
Source§fn clone(&self) -> RecoveryPermitter
fn clone(&self) -> RecoveryPermitter
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for RecoveryPermitter
impl !RefUnwindSafe for RecoveryPermitter
impl Send for RecoveryPermitter
impl Sync for RecoveryPermitter
impl Unpin for RecoveryPermitter
impl UnsafeUnpin for RecoveryPermitter
impl !UnwindSafe for RecoveryPermitter
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more