Trait paxakos::heartbeats::Config
source · [−]pub trait Config {
type Node: Node;
type Applicable: ApplicableTo<StateOf<Self::Node>> + 'static;
type RetryPolicy: RetryPolicy<Invocation = InvocationOf<Self::Node>, Error = AppendError<InvocationOf<Self::Node>>, StaticError = AppendError<InvocationOf<Self::Node>>>;
fn interval(&self) -> Option<Duration>;
fn new_heartbeat(&self) -> Self::Applicable;
fn retry_policy(&self) -> Self::RetryPolicy;
fn init(&mut self, node: &Self::Node) { ... }
fn update(&mut self, event: &EventFor<Self::Node>) { ... }
fn leader_interval(&self) -> Option<Duration> { ... }
}
Expand description
Heartbeats configuration.
Required Associated Types
type Applicable: ApplicableTo<StateOf<Self::Node>> + 'static
type Applicable: ApplicableTo<StateOf<Self::Node>> + 'static
The applicable that is used to fill gaps, usually a no-op.
type RetryPolicy: RetryPolicy<Invocation = InvocationOf<Self::Node>, Error = AppendError<InvocationOf<Self::Node>>, StaticError = AppendError<InvocationOf<Self::Node>>>
type RetryPolicy: RetryPolicy<Invocation = InvocationOf<Self::Node>, Error = AppendError<InvocationOf<Self::Node>>, StaticError = AppendError<InvocationOf<Self::Node>>>
Type of retry policy to be used.
See retry_policy
.
Required Methods
fn new_heartbeat(&self) -> Self::Applicable
fn new_heartbeat(&self) -> Self::Applicable
Creates a new heartbeat value.
fn retry_policy(&self) -> Self::RetryPolicy
fn retry_policy(&self) -> Self::RetryPolicy
Creates a retry policy.
Please note that a node that’s fallen too far behind may fail to catch
up using the heartbeat approach. This is because other nodes may respond
with Conflict::Converged
without
providing a log entry. In these cases, the node must ask another node
for a recent snapshot and install it. To detect such cases, one may use
a retry policy that checks for AppendError::Converged
and whether
the node could be caught_up
.
Provided Methods
Updates the configuration with the given event.
fn leader_interval(&self) -> Option<Duration>
fn leader_interval(&self) -> Option<Duration>
Interval at which leader nodes send heartbeats.