pub trait Config {
type Node: Node;
fn dilation_margin(&self) -> Duration;
fn init(&mut self, node: &Self::Node) { ... }
fn update(&mut self, event: &EventFor<Self::Node>) { ... }
}
Required Associated Types
Required Methods
sourcefn dilation_margin(&self) -> Duration
fn dilation_margin(&self) -> Duration
Upper bound on the amount of time dilation that may be seen within a State::lease_duration.
This value can and in some cases should be node-specific. The
implementation of Instant::now()
dictates what a valid upper bound is. We’re concerned with the following
scenario.
lease_duration
isd
.- This node begins appending a log entry.
- A majority of nodes accept the log entry and hand out leases.
- This node receives the acceptances and considers itself master until
t2 + d
. - This node attempts a master read and needs to decide wheter it’s still master.
If this node’s system (backing Instant::now()
) dilates/stretches time
between t2
and t5
then this dilation must be compensated for by this
value, dilation_margin
.