pub struct Continuum { /* private fields */ }
Expand description
The consistent hashing ring
A Continuum represents a ring of buckets where a node is associated with various points on the ring.
Implementations§
Source§impl Continuum
impl Continuum
Sourcepub fn node(&self, hash_key: &[u8]) -> Option<SocketAddr>
pub fn node(&self, hash_key: &[u8]) -> Option<SocketAddr>
Hash the given hash_key
to the server address.
Sourcepub fn node_iter(&self, hash_key: &[u8]) -> NodeIterator<'_> ⓘ
pub fn node_iter(&self, hash_key: &[u8]) -> NodeIterator<'_> ⓘ
Get an iterator of nodes starting at the original hashed node of the hash_key
.
This function is useful to find failover servers if the original ones are offline, which is cheaper than rebuilding the entire hash ring.
pub fn get_addr(&self, idx: &mut usize) -> Option<&SocketAddr>
Auto Trait Implementations§
impl Freeze for Continuum
impl RefUnwindSafe for Continuum
impl Send for Continuum
impl Sync for Continuum
impl Unpin for Continuum
impl UnwindSafe for Continuum
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