pub struct LeaseManager { /* private fields */ }Expand description
Higher-level lease manager with periodic cleanup
Implementations§
Source§impl LeaseManager
impl LeaseManager
Sourcepub fn new(config: LeaseConfig) -> Self
pub fn new(config: LeaseConfig) -> Self
Create a new lease manager
Sourcepub fn acquire(
&self,
queue_id: &str,
task_id: &str,
owner: &str,
lease_ms: Option<u64>,
) -> ClaimResult
pub fn acquire( &self, queue_id: &str, task_id: &str, owner: &str, lease_ms: Option<u64>, ) -> ClaimResult
Acquire a lease on a task
Sourcepub fn release(&self, queue_id: &str, token: &ClaimToken) -> Result<(), String>
pub fn release(&self, queue_id: &str, token: &ClaimToken) -> Result<(), String>
Release a lease
Sourcepub fn extend(
&self,
queue_id: &str,
token: &ClaimToken,
additional_ms: u64,
) -> Result<ClaimToken, String>
pub fn extend( &self, queue_id: &str, token: &ClaimToken, additional_ms: u64, ) -> Result<ClaimToken, String>
Extend a lease
Sourcepub fn stats(&self) -> ClaimStats
pub fn stats(&self) -> ClaimStats
Get claim manager statistics
Auto Trait Implementations§
impl !Freeze for LeaseManager
impl !RefUnwindSafe for LeaseManager
impl Send for LeaseManager
impl Sync for LeaseManager
impl Unpin for LeaseManager
impl UnsafeUnpin for LeaseManager
impl !UnwindSafe for LeaseManager
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more