pub struct ConsistentHashRing { /* private fields */ }Expand description
Consistent hash ring for node assignment
Implementations§
Source§impl ConsistentHashRing
impl ConsistentHashRing
Sourcepub fn remove_node(&mut self, node_id: &str)
pub fn remove_node(&mut self, node_id: &str)
Remove a node from the ring
Sourcepub fn get_nodes(&self, key: &str, count: usize) -> Vec<String>
pub fn get_nodes(&self, key: &str, count: usize) -> Vec<String>
Get nodes responsible for a key
Sourcepub fn get_primary_node(&self, key: &str) -> Option<String>
pub fn get_primary_node(&self, key: &str) -> Option<String>
Get the primary node for a key
Sourcepub fn node_count(&self) -> usize
pub fn node_count(&self) -> usize
Get the number of real nodes
Sourcepub fn list_nodes(&self) -> Vec<String>
pub fn list_nodes(&self) -> Vec<String>
List all real nodes
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ConsistentHashRing
impl RefUnwindSafe for ConsistentHashRing
impl Send for ConsistentHashRing
impl Sync for ConsistentHashRing
impl Unpin for ConsistentHashRing
impl UnwindSafe for ConsistentHashRing
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