Struct openraft::EffectiveMembership
source · pub struct EffectiveMembership<NID, N>{ /* 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>
impl<NID, N> EffectiveMembership<NID, N>
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>
impl<NID, N> EffectiveMembership<NID, N>
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>
impl<NID, N> Clone for EffectiveMembership<NID, N>
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> Debug for EffectiveMembership<NID, N>
impl<NID, N> Debug for EffectiveMembership<NID, N>
source§impl<NID, N> Default for EffectiveMembership<NID, N>
impl<NID, N> Default for EffectiveMembership<NID, N>
source§fn default() -> EffectiveMembership<NID, N>
fn default() -> EffectiveMembership<NID, N>
Returns the “default value” for a type. Read more
source§impl<NID, N, LID> From<(&LID, Membership<NID, N>)> for EffectiveMembership<NID, N>
impl<NID, N, LID> From<(&LID, Membership<NID, N>)> for EffectiveMembership<NID, N>
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>
impl<NID, N> MessageSummary<EffectiveMembership<NID, N>> for EffectiveMembership<NID, N>
source§impl<NID, N> PartialEq for EffectiveMembership<NID, N>
impl<NID, N> PartialEq for EffectiveMembership<NID, N>
impl<NID, N> Eq for EffectiveMembership<NID, N>
Auto Trait Implementations§
impl<NID, N> Freeze for EffectiveMembership<NID, N>
impl<NID, N> RefUnwindSafe for EffectiveMembership<NID, N>where
NID: RefUnwindSafe,
N: 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>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more