pub struct HashRing { /* private fields */ }Expand description
Sorted Murmur3 ring of virtual nodes.
Implementations§
Source§impl HashRing
impl HashRing
Sourcepub fn new(
nodes: impl IntoIterator<Item = NodeId>,
vnodes_per_node: u32,
) -> Self
pub fn new( nodes: impl IntoIterator<Item = NodeId>, vnodes_per_node: u32, ) -> Self
Build a ring from nodes, placing vnodes_per_node virtual nodes each.
Virtual node i of node is hashed as "{node_id}:{i}".
Sourcepub fn vnodes_per_node(&self) -> u32
pub fn vnodes_per_node(&self) -> u32
Virtual nodes placed for each physical node when this ring was built.
Sourcepub fn physical_nodes(&self) -> Vec<NodeId>
pub fn physical_nodes(&self) -> Vec<NodeId>
Distinct physical nodes, first-seen order.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for HashRing
impl RefUnwindSafe for HashRing
impl Send for HashRing
impl Sync for HashRing
impl Unpin for HashRing
impl UnsafeUnpin for HashRing
impl UnwindSafe for HashRing
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