pub struct MembershipManager { /* private fields */ }
Expand description
Cluster membership manager
Implementations§
Source§impl MembershipManager
impl MembershipManager
Sourcepub fn new(cluster_state: Arc<ClusterState>, config: MembershipConfig) -> Self
pub fn new(cluster_state: Arc<ClusterState>, config: MembershipConfig) -> Self
Create a new membership manager
Sourcepub async fn start(&mut self) -> Result<(), MembershipError>
pub async fn start(&mut self) -> Result<(), MembershipError>
Start membership management processes
Sourcepub async fn add_node(
&self,
node_id: NodeId,
node_info: NodeInfo,
) -> Result<(), MembershipError>
pub async fn add_node( &self, node_id: NodeId, node_info: NodeInfo, ) -> Result<(), MembershipError>
Add a node to the cluster
Sourcepub async fn remove_node(&self, node_id: &NodeId) -> Result<(), MembershipError>
pub async fn remove_node(&self, node_id: &NodeId) -> Result<(), MembershipError>
Remove a node from the cluster
Sourcepub async fn update_node(
&self,
node_id: &NodeId,
node_info: NodeInfo,
) -> Result<(), MembershipError>
pub async fn update_node( &self, node_id: &NodeId, node_info: NodeInfo, ) -> Result<(), MembershipError>
Update node information
Sourcepub async fn record_heartbeat(
&self,
node_id: &NodeId,
) -> Result<(), MembershipError>
pub async fn record_heartbeat( &self, node_id: &NodeId, ) -> Result<(), MembershipError>
Record a heartbeat from a node
Sourcepub async fn get_cluster_config(&self) -> ClusterConfig
pub async fn get_cluster_config(&self) -> ClusterConfig
Get current cluster configuration
Sourcepub async fn get_active_nodes(&self) -> Vec<NodeId>
pub async fn get_active_nodes(&self) -> Vec<NodeId>
Get list of active nodes
Sourcepub async fn is_node_active(&self, node_id: &NodeId) -> bool
pub async fn is_node_active(&self, node_id: &NodeId) -> bool
Check if a node is active
Sourcepub async fn get_cluster_stats(&self) -> ClusterStats
pub async fn get_cluster_stats(&self) -> ClusterStats
Get cluster statistics
Sourcepub fn subscribe_events(&self) -> Receiver<MembershipEvent>
pub fn subscribe_events(&self) -> Receiver<MembershipEvent>
Subscribe to membership events
Sourcepub fn command_sender(&self) -> Sender<MembershipCommand>
pub fn command_sender(&self) -> Sender<MembershipCommand>
Get command sender for external commands
Auto Trait Implementations§
impl Freeze for MembershipManager
impl !RefUnwindSafe for MembershipManager
impl Send for MembershipManager
impl Sync for MembershipManager
impl Unpin for MembershipManager
impl !UnwindSafe for MembershipManager
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