pub struct ConsistentHashRing { /* private fields */ }Expand description
Consistent hash ring for symbol routing.
Implementations§
Source§impl ConsistentHashRing
impl ConsistentHashRing
Sourcepub fn new(node_ids: &[u32], vnodes: u32) -> Self
pub fn new(node_ids: &[u32], vnodes: u32) -> Self
Create a ring with the given node IDs and virtual node count.
Sourcepub fn route(&self, object_id: &ObjectId, esi: u32) -> Option<u32>
pub fn route(&self, object_id: &ObjectId, esi: u32) -> Option<u32>
Route a symbol (identified by object_id + esi) to a node.
Sourcepub fn add_node(&mut self, node_id: u32) -> Self
pub fn add_node(&mut self, node_id: u32) -> Self
Add a node to the ring. Returns the set of symbols that need to be re-routed.
Sourcepub fn node_count(&self) -> usize
pub fn node_count(&self) -> usize
Number of distinct physical nodes in the ring.
Trait Implementations§
Source§impl Clone for ConsistentHashRing
impl Clone for ConsistentHashRing
Source§fn clone(&self) -> ConsistentHashRing
fn clone(&self) -> ConsistentHashRing
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto 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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, _span: NoopSpan) -> Self
fn instrument(self, _span: NoopSpan) -> Self
Instruments this future with a span (no-op when disabled).
Source§fn in_current_span(self) -> Self
fn in_current_span(self) -> Self
Instruments this future with the current span (no-op when disabled).