Struct openraft::EffectiveMembership
source · pub struct EffectiveMembership<NID, N>where
N: Node,
NID: NodeId,{ /* private fields */ }
Expand description
The currently active membership config.
It includes:
- the id of the log that sets this membership config,
- and the config.
An active config is just the last seen config in raft spec.
Implementations§
source§impl<NID, N> EffectiveMembership<NID, N>where
N: Node,
NID: NodeId,
impl<NID, N> EffectiveMembership<NID, N>where N: Node, NID: NodeId,
pub fn new(log_id: Option<LogId<NID>>, membership: Membership<NID, N>) -> Self
pub fn log_id(&self) -> &Option<LogId<NID>>
pub fn membership(&self) -> &Membership<NID, N>
source§impl<NID, N> EffectiveMembership<NID, N>where
N: Node,
NID: NodeId,
impl<NID, N> EffectiveMembership<NID, N>where N: Node, NID: NodeId,
Membership API
sourcepub fn voter_ids(&self) -> impl Iterator<Item = NID> + '_
pub fn voter_ids(&self) -> impl Iterator<Item = NID> + '_
Returns an Iterator of all voter node ids. Learners are not included.
sourcepub fn get_node(&self, node_id: &NID) -> Option<&N>
pub fn get_node(&self, node_id: &NID) -> Option<&N>
Get a the node(either voter or learner) by node id.
sourcepub fn nodes(&self) -> impl Iterator<Item = (&NID, &N)>
pub fn nodes(&self) -> impl Iterator<Item = (&NID, &N)>
Returns an Iterator of all nodes(voters and learners).
sourcepub fn get_joint_config(&self) -> &Vec<Vec<NID>>
pub fn get_joint_config(&self) -> &Vec<Vec<NID>>
Returns reference to the joint config.
Membership is defined by a joint of multiple configs. Each config is a vec of node-id.
Trait Implementations§
source§impl<NID, N> Clone for EffectiveMembership<NID, N>where
N: Node + Clone,
NID: NodeId + Clone,
impl<NID, N> Clone for EffectiveMembership<NID, N>where N: Node + Clone, NID: NodeId + Clone,
source§fn clone(&self) -> EffectiveMembership<NID, N>
fn clone(&self) -> EffectiveMembership<NID, N>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<NID, N> Default for EffectiveMembership<NID, N>where
N: Node + Default,
NID: NodeId + Default,
impl<NID, N> Default for EffectiveMembership<NID, N>where N: Node + Default, NID: NodeId + Default,
source§fn default() -> EffectiveMembership<NID, N>
fn default() -> EffectiveMembership<NID, N>
Returns the “default value” for a type. Read more
source§impl<NID, N, Ent> From<&Ent> for EffectiveMembership<NID, N>where
N: Node,
NID: NodeId,
Ent: RaftEntry<NID, N>,
impl<NID, N, Ent> From<&Ent> for EffectiveMembership<NID, N>where N: Node, NID: NodeId, Ent: RaftEntry<NID, N>,
Build a EffectiveMembership from a membership config entry
source§impl<NID, N, LID> From<(&LID, Membership<NID, N>)> for EffectiveMembership<NID, N>where
N: Node,
NID: NodeId,
LID: RaftLogId<NID>,
impl<NID, N, LID> From<(&LID, Membership<NID, N>)> for EffectiveMembership<NID, N>where N: Node, NID: NodeId, LID: RaftLogId<NID>,
source§fn from(v: (&LID, Membership<NID, N>)) -> Self
fn from(v: (&LID, Membership<NID, N>)) -> Self
Converts to this type from the input type.
source§impl<NID, N> MessageSummary<EffectiveMembership<NID, N>> for EffectiveMembership<NID, N>where
N: Node,
NID: NodeId,
impl<NID, N> MessageSummary<EffectiveMembership<NID, N>> for EffectiveMembership<NID, N>where N: Node, NID: NodeId,
source§impl<NID, N> PartialEq<EffectiveMembership<NID, N>> for EffectiveMembership<NID, N>where
N: Node,
NID: NodeId,
impl<NID, N> PartialEq<EffectiveMembership<NID, N>> for EffectiveMembership<NID, N>where N: Node, NID: NodeId,
impl<NID, N> Eq for EffectiveMembership<NID, N>where N: Node + Eq, NID: NodeId + Eq,
impl<NID, N> StructuralEq for EffectiveMembership<NID, N>where N: Node, NID: NodeId,
Auto Trait Implementations§
impl<NID, N> RefUnwindSafe for EffectiveMembership<NID, N>where N: RefUnwindSafe, NID: RefUnwindSafe,
impl<NID, N> Send for EffectiveMembership<NID, N>
impl<NID, N> Sync for EffectiveMembership<NID, N>
impl<NID, N> Unpin for EffectiveMembership<NID, N>where NID: Unpin,
impl<NID, N> UnwindSafe for EffectiveMembership<NID, N>where N: RefUnwindSafe, NID: UnwindSafe + RefUnwindSafe,
Blanket Implementations§
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.