pub struct TaskLeaseGuard { /* private fields */ }Expand description
Shared in-memory lease guard observed by task code and heartbeat code.
Implementations§
Source§impl TaskLeaseGuard
impl TaskLeaseGuard
Sourcepub fn new(lease: TaskLease, renewal_timeout: Duration) -> Self
pub fn new(lease: TaskLease, renewal_timeout: Duration) -> Self
Creates a guard with the provided renewal timeout.
Sourcepub fn with_shutdown_token(
lease: TaskLease,
renewal_timeout: Duration,
shutdown_token: CancellationToken,
) -> Self
pub fn with_shutdown_token( lease: TaskLease, renewal_timeout: Duration, shutdown_token: CancellationToken, ) -> Self
Creates a guard that also observes worker shutdown.
Sourcepub fn record_renewed(&self)
pub fn record_renewed(&self)
Records a successful persistent lease renewal.
Sourcepub fn mark_lost(&self) -> TaskCoreError
pub fn mark_lost(&self) -> TaskCoreError
Marks the lease as lost and returns the corresponding error.
Sourcepub fn mark_shutdown_requested(&self) -> TaskCoreError
pub fn mark_shutdown_requested(&self) -> TaskCoreError
Marks worker shutdown and returns the corresponding error.
Sourcepub fn ensure_active(&self) -> Result<()>
pub fn ensure_active(&self) -> Result<()>
Returns success only while the lease is still safe for writes.
Trait Implementations§
Source§impl Clone for TaskLeaseGuard
impl Clone for TaskLeaseGuard
Source§fn clone(&self) -> TaskLeaseGuard
fn clone(&self) -> TaskLeaseGuard
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 TaskLeaseGuard
impl RefUnwindSafe for TaskLeaseGuard
impl Send for TaskLeaseGuard
impl Sync for TaskLeaseGuard
impl Unpin for TaskLeaseGuard
impl UnsafeUnpin for TaskLeaseGuard
impl UnwindSafe for TaskLeaseGuard
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