pub trait State: State {
fn lease_duration(&self) -> Duration;
fn previous_lease_duration(&self) -> Duration;
}
Required Methods
fn lease_duration(&self) -> Duration
fn lease_duration(&self) -> Duration
Duration of a master lease.
fn previous_lease_duration(&self) -> Duration
fn previous_lease_duration(&self) -> Duration
Remaining duration of a lease this node gave out in a previous run or
ZERO
.
This value is concerned with the following scenario.
lease_duration
isd1
- Node A hands out a lease to node B.
- Node A crashes.
lease_duration
is set tod2
<d1
.- A node other than node A creates a snapshot (lease duration is
d2
). - Node A recovers using the snapshot.
- Node A is asked to cast a vote by node C and must decide whether the new lease would be in conflict with any it handed out before its crash.
If the time it takes to create, transfer and recover from a snapshot
will always be greater than the lease_duration
, then an implementation
can safely return ZERO
.