pub struct WorkerLease {
pub node_id: u64,
pub profile: WorkerProfile,
pub acquired_unix_secs: i64,
pub renewed_unix_secs: i64,
pub ttl_secs: u32,
pub grace_secs: u32,
}Expand description
A worker lease in the leader’s directory — drives liveness.
Fields§
§node_id: u64§profile: WorkerProfile§acquired_unix_secs: i64Unix epoch seconds when the lease was granted.
renewed_unix_secs: i64Unix epoch seconds of last successful heartbeat renewal.
ttl_secs: u32Current TTL applied to this worker (adaptive).
grace_secs: u32Grace period (seconds) applied on top of ttl_secs before the
leader marks this worker as Unreachable. Stored on the lease
so the value used at lease-grant time is durable even if the
leader’s AdaptiveTtlConfig later changes.
Implementations§
Source§impl WorkerLease
impl WorkerLease
Sourcepub fn is_expired(&self, now_unix_secs: i64, grace_secs: u32) -> bool
pub fn is_expired(&self, now_unix_secs: i64, grace_secs: u32) -> bool
True if now_unix_secs - renewed_unix_secs > ttl_secs + grace.
The grace_secs argument lets callers override the lease’s
stored grace value (e.g. to apply a temporarily-extended grace
during a known leadership transition).
Trait Implementations§
Source§impl Clone for WorkerLease
impl Clone for WorkerLease
Source§fn clone(&self) -> WorkerLease
fn clone(&self) -> WorkerLease
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 moreSource§impl Debug for WorkerLease
impl Debug for WorkerLease
Source§impl<'de> Deserialize<'de> for WorkerLease
impl<'de> Deserialize<'de> for WorkerLease
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for WorkerLease
impl RefUnwindSafe for WorkerLease
impl Send for WorkerLease
impl Sync for WorkerLease
impl Unpin for WorkerLease
impl UnsafeUnpin for WorkerLease
impl UnwindSafe for WorkerLease
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