Enum foca::Notification
source · pub enum Notification<T> {
MemberUp(T),
MemberDown(T),
Rename(T, T),
Active,
Idle,
Defunct,
Rejoin(T),
}
Expand description
A Notification contains information about high-level relevant state changes in the cluster or Foca itself.
Variants§
MemberUp(T)
Foca discovered a new active member with identity T.
MemberDown(T)
A previously active member has been declared down by the cluster.
If Foca detects a down member but didn’t know about its activity before, this notification will not be emitted.
Can only happen if MemberUp(T)
happened before.
Rename(T, T)
Foca has learned that there’s a more recent identity with the same address and chose to use it instead of the previous one.
So Notification::Rename(A,B)
means that we knew about a member
A
but now there’s a B
with the same Identity::Addr
and
foca chose to keep it. i.e. B.win_addr_conflict(A) == true
.
This happens naturally when a member rejoins the cluster after
any event (maybe they were declared down and Identity::renew
d
themselves, maybe it’s a restart/upgrade process)
Example:
If A
was considered Down and B
is Alive, you’ll get
two notifications, in order:
Notification::Rename(A,B)
Notification::MemberUp(B)
However, if there’s no liveness change (both are active
or both are down), you’ll only get the Rename
notification
Active
Foca’s current identity is known by at least one active member of the cluster.
Fired when successfully joining a cluster for the first time and every time after a successful identity change.
Idle
All known active members have either left the cluster or been declared down.
Defunct
Foca’s current identity has been declared down.
Manual intervention via Foca::change_identity
or
Foca::reuse_down_identity
is required to return to a functioning
state.
Rejoin(T)
Foca automatically changed its identity and rejoined the cluster after being declared down.
This happens instead of Defunct
when identities opt-in on
Identity::renew()
functionality.
Trait Implementations§
source§impl<T: Clone> Clone for Notification<T>
impl<T: Clone> Clone for Notification<T>
source§fn clone(&self) -> Notification<T>
fn clone(&self) -> Notification<T>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl<T: Debug> Debug for Notification<T>
impl<T: Debug> Debug for Notification<T>
source§impl<'de, T> Deserialize<'de> for Notification<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for Notification<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: PartialEq> PartialEq for Notification<T>
impl<T: PartialEq> PartialEq for Notification<T>
source§fn eq(&self, other: &Notification<T>) -> bool
fn eq(&self, other: &Notification<T>) -> bool
self
and other
values to be equal, and is used
by ==
.