pub struct PartitionTable { /* private fields */ }
Expand description
Consistent hashing ring for partition distribution
Implementations§
Source§impl PartitionTable
impl PartitionTable
Sourcepub fn add_node(&mut self, node_id: NodeId, virtual_nodes: usize)
pub fn add_node(&mut self, node_id: NodeId, virtual_nodes: usize)
Add a node with virtual nodes to the ring
Sourcepub fn remove_node(&mut self, node_id: &NodeId)
pub fn remove_node(&mut self, node_id: &NodeId)
Remove a node from the ring
Sourcepub fn get_nodes_for_key(
&self,
key: &[u8],
replication_factor: usize,
) -> Vec<NodeId>
pub fn get_nodes_for_key( &self, key: &[u8], replication_factor: usize, ) -> Vec<NodeId>
Get nodes responsible for a key (with replication)
Sourcepub fn get_partition(&self, key: &[u8]) -> PartitionId
pub fn get_partition(&self, key: &[u8]) -> PartitionId
Get partition for a key
Sourcepub fn get_partitions_for_node(&self, node_id: &NodeId) -> Vec<PartitionId>
pub fn get_partitions_for_node(&self, node_id: &NodeId) -> Vec<PartitionId>
Get partitions assigned to a node
Sourcepub fn get_distribution_stats(&self) -> PartitionStats
pub fn get_distribution_stats(&self) -> PartitionStats
Get distribution statistics
Auto Trait Implementations§
impl Freeze for PartitionTable
impl RefUnwindSafe for PartitionTable
impl Send for PartitionTable
impl Sync for PartitionTable
impl Unpin for PartitionTable
impl UnwindSafe for PartitionTable
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