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 more