pub struct LeaseTimings { /* private fields */ }Expand description
Lease timing capability for every durable single-writer lane the runtime claims: session execution leases, turn-input claims, queued-work claims, process leases, and durable effect-replay leases.
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<Self, LeaseTimingsError>
pub fn new( ttl: Duration, renew_interval: Duration, ) -> Result<Self, 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<Self, LeaseTimingsError>
pub fn from_ttl(ttl: Duration) -> Result<Self, 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
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
impl Eq for LeaseTimings
Source§impl PartialEq for LeaseTimings
impl PartialEq for LeaseTimings
Source§fn eq(&self, other: &LeaseTimings) -> bool
fn eq(&self, other: &LeaseTimings) -> bool
self and other values to be equal, and is used by ==.