pub struct PartitionManager { /* private fields */ }
Expand description
Partition manager for data distribution
Implementations§
Source§impl PartitionManager
impl PartitionManager
Sourcepub async fn add_node(&self, node_id: NodeId) -> Result<(), PartitionError>
pub async fn add_node(&self, node_id: NodeId) -> Result<(), PartitionError>
Add a node to the partition ring
Sourcepub async fn remove_node(&self, node_id: &NodeId) -> Result<(), PartitionError>
pub async fn remove_node(&self, node_id: &NodeId) -> Result<(), PartitionError>
Remove a node from the partition ring
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_partition_for_key(&self, key: &[u8]) -> PartitionId
pub async fn get_partition_for_key(&self, key: &[u8]) -> PartitionId
Get partition 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 all partitions assigned to a node
Sourcepub async fn is_node_responsible(&self, node_id: &NodeId, key: &[u8]) -> bool
pub async fn is_node_responsible(&self, node_id: &NodeId, key: &[u8]) -> bool
Check if a node is responsible for a key
Sourcepub async fn get_distribution_stats(&self) -> PartitionStats
pub async fn get_distribution_stats(&self) -> PartitionStats
Get partition distribution statistics
Sourcepub async fn rebalance(&self) -> Result<(), PartitionError>
pub async fn rebalance(&self) -> Result<(), PartitionError>
Rebalance partitions after node changes
Auto Trait Implementations§
impl Freeze for PartitionManager
impl !RefUnwindSafe for PartitionManager
impl Send for PartitionManager
impl Sync for PartitionManager
impl Unpin for PartitionManager
impl !UnwindSafe for PartitionManager
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