pub struct ConsistentHashRing { /* private fields */ }Expand description
Consistent hash ring for stable partition assignment.
Virtual nodes (vnodes) per physical node are proportional to weight.
Implementations§
Source§impl ConsistentHashRing
impl ConsistentHashRing
Sourcepub fn add_node(&mut self, node: ClusterNode)
pub fn add_node(&mut self, node: ClusterNode)
Add a node to the ring.
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_node(&self, key: &[u8]) -> Option<&ClusterNode>
pub fn get_node(&self, key: &[u8]) -> Option<&ClusterNode>
Look up the responsible node for a given key.
Sourcepub fn node_count(&self) -> usize
pub fn node_count(&self) -> usize
Return the number of physical nodes.
Sourcepub fn vnode_count(&self) -> usize
pub fn vnode_count(&self) -> usize
Return the total number of virtual nodes in the ring.
Auto Trait Implementations§
impl Freeze for ConsistentHashRing
impl RefUnwindSafe for ConsistentHashRing
impl Send for ConsistentHashRing
impl Sync for ConsistentHashRing
impl Unpin for ConsistentHashRing
impl UnsafeUnpin 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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request