pub trait State: State {
    fn lease_duration(&self) -> Duration;
    fn previous_lease_duration(&self) -> Duration;
}

Required Methods

Duration of a master lease.

Remaining duration of a lease this node gave out in a previous run or ZERO.

This value is concerned with the following scenario.

  1. lease_duration is d1
  2. Node A hands out a lease to node B.
  3. Node A crashes.
  4. lease_duration is set to d2 < d1.
  5. A node other than node A creates a snapshot (lease duration is d2).
  6. Node A recovers using the snapshot.
  7. 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.

Implementors