pub struct ClusterState {
pub config: Arc<RwLock<ClusterConfig>>,
pub local_node: NodeId,
pub consensus_state: Arc<RwLock<ConsensusState>>,
pub partition_table: Arc<RwLock<PartitionTable>>,
}
Expand description
Cluster state
Fields§
§config: Arc<RwLock<ClusterConfig>>
§local_node: NodeId
§consensus_state: Arc<RwLock<ConsensusState>>
§partition_table: Arc<RwLock<PartitionTable>>
Implementations§
Source§impl ClusterState
impl ClusterState
Sourcepub async fn get_leader(&self) -> Option<NodeId>
pub async fn get_leader(&self) -> Option<NodeId>
Get the current leader node
Sourcepub async fn get_partition_for_key(&self, key: &[u8]) -> PartitionId
pub async fn get_partition_for_key(&self, key: &[u8]) -> PartitionId
Get partition assignment for a key
Sourcepub async fn get_nodes_for_partition(
&self,
partition: &PartitionId,
) -> Vec<NodeId>
pub async fn get_nodes_for_partition( &self, partition: &PartitionId, ) -> Vec<NodeId>
Get nodes responsible for a partition
Sourcepub async fn get_nodes_for_key(&self, key: &[u8]) -> Vec<NodeId>
pub async fn get_nodes_for_key(&self, key: &[u8]) -> Vec<NodeId>
Get nodes responsible for a key
Sourcepub async fn get_partitions_for_node(
&self,
node_id: &NodeId,
) -> Vec<PartitionId>
pub async fn get_partitions_for_node( &self, node_id: &NodeId, ) -> Vec<PartitionId>
Get partitions for a node
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ClusterState
impl !RefUnwindSafe for ClusterState
impl Send for ClusterState
impl Sync for ClusterState
impl Unpin for ClusterState
impl !UnwindSafe for ClusterState
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