pub trait Membership<T>:
Sync
+ Send
+ 'staticwhere
T: TypeConfig,{
Show 29 methods
// Required methods
fn members<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Vec<NodeMeta>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn replication_peers<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Vec<NodeMeta>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn voters<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Vec<NodeMeta>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn initial_cluster_size<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = usize> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn nodes_with_status<'life0, 'async_trait>(
&'life0 self,
status: NodeStatus,
) -> Pin<Box<dyn Future<Output = Vec<NodeMeta>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_node_status<'life0, 'async_trait>(
&'life0 self,
node_id: u32,
) -> Pin<Box<dyn Future<Output = Option<NodeStatus>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn check_cluster_is_ready<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_peers_id_with_condition<'life0, 'async_trait, F>(
&'life0 self,
condition: F,
) -> Pin<Box<dyn Future<Output = Vec<u32>> + Send + 'async_trait>>
where F: Fn(i32) -> bool + Send + Sync + 'static + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait;
fn retrieve_cluster_membership_config<'life0, 'async_trait>(
&'life0 self,
current_leader_id: Option<u32>,
) -> Pin<Box<dyn Future<Output = ClusterMembership> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn update_cluster_conf_from_leader<'life0, 'life1, 'async_trait>(
&'life0 self,
my_id: u32,
my_current_term: u64,
current_conf_version: u64,
current_leader_id: Option<u32>,
cluster_conf_change_req: &'life1 ClusterConfChangeRequest,
) -> Pin<Box<dyn Future<Output = Result<ClusterConfUpdateResponse>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn get_cluster_conf_version<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = u64> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn update_conf_version<'life0, 'async_trait>(
&'life0 self,
version: u64,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn incr_conf_version<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn add_learner<'life0, 'async_trait>(
&'life0 self,
node_id: u32,
address: String,
status: NodeStatus,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn activate_node<'life0, 'async_trait>(
&'life0 mut self,
new_node_id: u32,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn update_node_status<'life0, 'async_trait>(
&'life0 self,
node_id: u32,
status: NodeStatus,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn contains_node<'life0, 'async_trait>(
&'life0 self,
node_id: u32,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn retrieve_node_meta<'life0, 'async_trait>(
&'life0 self,
node_id: u32,
) -> Pin<Box<dyn Future<Output = Option<NodeMeta>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn remove_node<'life0, 'async_trait>(
&'life0 self,
node_id: u32,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn force_remove_node<'life0, 'async_trait>(
&'life0 self,
node_id: u32,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_all_nodes<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Vec<NodeMeta>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn pre_warm_connections<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_peer_channel<'life0, 'async_trait>(
&'life0 self,
node_id: u32,
conn_type: ConnectionType,
) -> Pin<Box<dyn Future<Output = Option<Channel>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_address<'life0, 'async_trait>(
&'life0 self,
node_id: u32,
) -> Pin<Box<dyn Future<Output = Option<String>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn apply_config_change<'life0, 'async_trait>(
&'life0 self,
change: MembershipChange,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn notify_config_applied<'life0, 'async_trait>(
&'life0 self,
index: u64,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_zombie_candidates<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Vec<u32>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn can_rejoin<'life0, 'async_trait>(
&'life0 self,
node_id: u32,
role: i32,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided method
fn is_single_node_cluster<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
}Required Methods§
Sourcefn members<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Vec<NodeMeta>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn members<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Vec<NodeMeta>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
All nodes (including itself)
Sourcefn replication_peers<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Vec<NodeMeta>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn replication_peers<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Vec<NodeMeta>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
All non-self nodes (including Syncing and Active) Note: Joining node has not start its Raft event processing engine yet.
Sourcefn voters<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Vec<NodeMeta>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn voters<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Vec<NodeMeta>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
All non-self nodes in Active state
Sourcefn initial_cluster_size<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = usize> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn initial_cluster_size<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = usize> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get the initial cluster size from configuration
This value is determined at node startup from the initial_cluster configuration
and remains constant throughout the node’s lifetime. It represents the designed
cluster size, not the current runtime membership state.
Used for:
- Quorum calculations
- Cluster topology decisions
§Safety
This method is safe to use for cluster topology decisions as it’s based on immutable configuration rather than runtime state that could be affected by network partitions or bugs.
Sourcefn nodes_with_status<'life0, 'async_trait>(
&'life0 self,
status: NodeStatus,
) -> Pin<Box<dyn Future<Output = Vec<NodeMeta>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn nodes_with_status<'life0, 'async_trait>(
&'life0 self,
status: NodeStatus,
) -> Pin<Box<dyn Future<Output = Vec<NodeMeta>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
All pending active nodes in Active state
fn get_node_status<'life0, 'async_trait>(
&'life0 self,
node_id: u32,
) -> Pin<Box<dyn Future<Output = Option<NodeStatus>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn check_cluster_is_ready<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_peers_id_with_condition<'life0, 'async_trait, F>( &'life0 self, condition: F, ) -> Pin<Box<dyn Future<Output = Vec<u32>> + Send + 'async_trait>>
Sourcefn retrieve_cluster_membership_config<'life0, 'async_trait>(
&'life0 self,
current_leader_id: Option<u32>,
) -> Pin<Box<dyn Future<Output = ClusterMembership> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn retrieve_cluster_membership_config<'life0, 'async_trait>(
&'life0 self,
current_leader_id: Option<u32>,
) -> Pin<Box<dyn Future<Output = ClusterMembership> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
retrieve latest cluster membership with current leader ID
§Parameters
current_leader_id: Optional current leader ID from runtime state
Sourcefn update_cluster_conf_from_leader<'life0, 'life1, 'async_trait>(
&'life0 self,
my_id: u32,
my_current_term: u64,
current_conf_version: u64,
current_leader_id: Option<u32>,
cluster_conf_change_req: &'life1 ClusterConfChangeRequest,
) -> Pin<Box<dyn Future<Output = Result<ClusterConfUpdateResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn update_cluster_conf_from_leader<'life0, 'life1, 'async_trait>(
&'life0 self,
my_id: u32,
my_current_term: u64,
current_conf_version: u64,
current_leader_id: Option<u32>,
cluster_conf_change_req: &'life1 ClusterConfChangeRequest,
) -> Pin<Box<dyn Future<Output = Result<ClusterConfUpdateResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
invoked when receive requests from Leader
fn get_cluster_conf_version<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = u64> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn update_conf_version<'life0, 'async_trait>(
&'life0 self,
version: u64,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn incr_conf_version<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Sourcefn add_learner<'life0, 'async_trait>(
&'life0 self,
node_id: u32,
address: String,
status: NodeStatus,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn add_learner<'life0, 'async_trait>(
&'life0 self,
node_id: u32,
address: String,
status: NodeStatus,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Add a new node as a learner
Sourcefn activate_node<'life0, 'async_trait>(
&'life0 mut self,
new_node_id: u32,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn activate_node<'life0, 'async_trait>(
&'life0 mut self,
new_node_id: u32,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Activate node
Sourcefn update_node_status<'life0, 'async_trait>(
&'life0 self,
node_id: u32,
status: NodeStatus,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn update_node_status<'life0, 'async_trait>(
&'life0 self,
node_id: u32,
status: NodeStatus,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Update status of a node
Sourcefn contains_node<'life0, 'async_trait>(
&'life0 self,
node_id: u32,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn contains_node<'life0, 'async_trait>(
&'life0 self,
node_id: u32,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Check if the node already exists
fn retrieve_node_meta<'life0, 'async_trait>(
&'life0 self,
node_id: u32,
) -> Pin<Box<dyn Future<Output = Option<NodeMeta>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Sourcefn remove_node<'life0, 'async_trait>(
&'life0 self,
node_id: u32,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn remove_node<'life0, 'async_trait>(
&'life0 self,
node_id: u32,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Elegantly remove nodes
Sourcefn force_remove_node<'life0, 'async_trait>(
&'life0 self,
node_id: u32,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn force_remove_node<'life0, 'async_trait>(
&'life0 self,
node_id: u32,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Forcefully remove faulty nodes
Sourcefn get_all_nodes<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Vec<NodeMeta>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_all_nodes<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Vec<NodeMeta>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get all node status
Sourcefn pre_warm_connections<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn pre_warm_connections<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Pre-warms connection cache for all replication peers
fn get_peer_channel<'life0, 'async_trait>(
&'life0 self,
node_id: u32,
conn_type: ConnectionType,
) -> Pin<Box<dyn Future<Output = Option<Channel>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_address<'life0, 'async_trait>(
&'life0 self,
node_id: u32,
) -> Pin<Box<dyn Future<Output = Option<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Sourcefn apply_config_change<'life0, 'async_trait>(
&'life0 self,
change: MembershipChange,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn apply_config_change<'life0, 'async_trait>(
&'life0 self,
change: MembershipChange,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Apply committed configuration change
fn notify_config_applied<'life0, 'async_trait>(
&'life0 self,
index: u64,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_zombie_candidates<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Vec<u32>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Provided Methods§
Sourcefn is_single_node_cluster<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn is_single_node_cluster<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Check if this is a single-node cluster
Returns true if the initial cluster size is 1, indicating this node
was configured to run in standalone mode without any peers.
This is a convenience method equivalent to initial_cluster_size() == 1.
§Use Cases
- Skip Raft election in single-node mode (no peers to vote)
- Skip log replication in single-node mode (no peers to replicate to)
- Optimize performance by avoiding unnecessary network operations
§Safety
Safe for all cluster topology decisions as it’s based on immutable configuration.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.