pub struct LeaseTimings { /* private fields */ }Expand description
Lease timing capability for the durable single-writer lease lanes the runtime renews on a cadence: session execution leases, process leases, and durable effect-replay leases.
Queued-work and turn-input claims are deliberately not governed by this type: they are not leases, carry no TTL, and are never renewed. A claim is live exactly while the session-execution-lease generation it pins still holds the session lease (ADR 0029), so it inherits its liveness from the session lease lane rather than from a clock.
The TTL is the failover-latency vs false-takeover-risk knob: a shorter TTL
lets a peer reclaim work from a crashed owner sooner, while a longer TTL
tolerates slower renewal under load. The renew interval is how often a live
owner extends its leases; the constructor enforces
ttl >= 3 * renew_interval so a healthy owner always has renewal slack
before its lease can expire under it.
Defaults to 30s TTL with a 10s renew interval.
Implementations§
Source§impl LeaseTimings
impl LeaseTimings
Sourcepub fn new(
ttl: Duration,
renew_interval: Duration,
) -> Result<LeaseTimings, LeaseTimingsError>
pub fn new( ttl: Duration, renew_interval: Duration, ) -> Result<LeaseTimings, LeaseTimingsError>
Build lease timings, enforcing ttl >= 3 * renew_interval and
millisecond-resolution non-zero values (leases are persisted in epoch
milliseconds).
Sourcepub fn from_ttl(ttl: Duration) -> Result<LeaseTimings, LeaseTimingsError>
pub fn from_ttl(ttl: Duration) -> Result<LeaseTimings, LeaseTimingsError>
Build lease timings from a TTL alone, deriving the renew interval as
ttl / 3 (the boundary the invariant allows).
pub fn ttl(&self) -> Duration
pub fn renew_interval(&self) -> Duration
Sourcepub fn ttl_ms(&self) -> u64
pub fn ttl_ms(&self) -> u64
TTL in epoch milliseconds, as passed to store lease claim/renew calls (session execution, process, and effect-replay leases).
pub fn renew_interval_ms(&self) -> u64
Trait Implementations§
Source§impl Clone for LeaseTimings
impl Clone for LeaseTimings
Source§fn clone(&self) -> LeaseTimings
fn clone(&self) -> LeaseTimings
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for LeaseTimings
Source§impl Debug for LeaseTimings
impl Debug for LeaseTimings
Source§impl Default for LeaseTimings
impl Default for LeaseTimings
Source§fn default() -> LeaseTimings
fn default() -> LeaseTimings
impl Eq for LeaseTimings
Source§impl PartialEq for LeaseTimings
impl PartialEq for LeaseTimings
impl StructuralPartialEq for LeaseTimings
Auto Trait Implementations§
impl Freeze for LeaseTimings
impl RefUnwindSafe for LeaseTimings
impl Send for LeaseTimings
impl Sync for LeaseTimings
impl Unpin for LeaseTimings
impl UnsafeUnpin for LeaseTimings
impl UnwindSafe for LeaseTimings
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.