pub struct ClusterConfig { /* private fields */ }Expand description
Tracks cluster members with their addresses and a monotonically increasing version
Implementations§
Source§impl ClusterConfig
impl ClusterConfig
Sourcepub fn new(members: Vec<(NodeId, String)>, version: u64) -> Self
pub fn new(members: Vec<(NodeId, String)>, version: u64) -> Self
Create a new cluster config with the given members and version
Sourcepub fn member_ids(&self) -> HashSet<NodeId>
pub fn member_ids(&self) -> HashSet<NodeId>
Get the list of member node IDs
Sourcepub fn quorum_size(&self) -> usize
pub fn quorum_size(&self) -> usize
Get the majority quorum size for this config
Sourcepub fn with_added_member(&self, node_id: NodeId, address: String) -> Self
pub fn with_added_member(&self, node_id: NodeId, address: String) -> Self
Add a member to the config, returning a new config with incremented version
Sourcepub fn without_member(&self, node_id: NodeId) -> Self
pub fn without_member(&self, node_id: NodeId) -> Self
Remove a member from the config, returning a new config with incremented version
Trait Implementations§
Source§impl Clone for ClusterConfig
impl Clone for ClusterConfig
Source§fn clone(&self) -> ClusterConfig
fn clone(&self) -> ClusterConfig
Returns a duplicate 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 Debug for ClusterConfig
impl Debug for ClusterConfig
Source§impl PartialEq for ClusterConfig
impl PartialEq for ClusterConfig
impl Eq for ClusterConfig
impl StructuralPartialEq for ClusterConfig
Auto Trait Implementations§
impl Freeze for ClusterConfig
impl RefUnwindSafe for ClusterConfig
impl Send for ClusterConfig
impl Sync for ClusterConfig
impl Unpin for ClusterConfig
impl UnsafeUnpin for ClusterConfig
impl UnwindSafe for ClusterConfig
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