pub enum Timer<T> {
ProbeRandomMember(TimerToken),
SendIndirectProbe {
probed_id: T,
token: TimerToken,
},
ChangeSuspectToDown {
member_id: T,
incarnation: Incarnation,
token: TimerToken,
},
PeriodicAnnounce(TimerToken),
PeriodicAnnounceDown(TimerToken),
PeriodicGossip(TimerToken),
RemoveDown(T),
}
Expand description
Timer is an event that’s scheduled by a Runtime
. You won’t need
to construct or understand these, just ensure a timely delivery.
Warning: This type implements Ord
to facilitate correcting
for out-of-order delivery due to the runtime lagging for whatever
reason. It assumes the events being sorted come from the same foca
instance and are not being persisted after being handled
via crate::Foca::handle_timer
. Any use outside of this scenario
will likely lead to unintended consequences.
Variants§
ProbeRandomMember(TimerToken)
Pick a random active member and initiate the probe cycle.
SendIndirectProbe
Send indirect probes if the direct one hasn’t completed yet.
ChangeSuspectToDown
Transitions member T from Suspect to Down if the incarnation is still the same.
Fields
member_id: T
Target member identity
incarnation: Incarnation
Its Incarnation the moment the suspicion was raised. If the member refutes the suspicion (by increasing its Incarnation), this won’t match and it won’t be declared Down.
token: TimerToken
See TimerToken
PeriodicAnnounce(TimerToken)
Sends a crate::Message::Announce
to randomly chosen members as
specified by crate::Config::periodic_announce
PeriodicAnnounceDown(TimerToken)
Sends a crate::Message::Announce
to randomly chosen members
that are condidered crate::State::Down
as specified by
crate::Config::periodic_announce_to_down_members
PeriodicGossip(TimerToken)
Sends a crate::Message::Gossip
to randomly chosen members as
specified by crate::Config::periodic_gossip
RemoveDown(T)
Forgets about dead member T
, allowing them to join the
cluster again with the same identity.
Trait Implementations§
source§impl<'de, T> Deserialize<'de> for Timer<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for Timer<T>where
T: Deserialize<'de>,
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
source§impl<T: Eq> Ord for Timer<T>
impl<T: Eq> Ord for Timer<T>
source§impl<T: PartialEq> PartialEq for Timer<T>
impl<T: PartialEq> PartialEq for Timer<T>
source§impl<T: PartialEq> PartialOrd for Timer<T>
impl<T: PartialEq> PartialOrd for Timer<T>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more