[][src]Struct hash_ring::HashRing

pub struct HashRing<T, S = BuildHasherDefault<XxHash64>> { /* fields omitted */ }

HashRing

Implementations

impl<T: ToString + Clone> HashRing<T, BuildHasherDefault<XxHash64>>[src]

pub fn new(
    nodes: Vec<T>,
    replicas: isize
) -> HashRing<T, BuildHasherDefault<XxHash64>>
[src]

Creates a new hash ring with the specified nodes. Replicas is the number of virtual nodes each node has to make a better distribution.

impl<T, S> HashRing<T, S> where
    T: ToString + Clone,
    S: BuildHasher
[src]

pub fn with_hasher(
    nodes: Vec<T>,
    replicas: isize,
    hash_builder: S
) -> HashRing<T, S>
[src]

pub fn add_node(&mut self, node: &T)[src]

Adds a node to the hash ring

pub fn remove_node(&mut self, node: &T)[src]

Deletes a node from the hash ring

pub fn get_node(&self, key: String) -> Option<&T>[src]

Gets the node a specific key belongs to

Auto Trait Implementations

impl<T, S> RefUnwindSafe for HashRing<T, S> where
    S: RefUnwindSafe,
    T: RefUnwindSafe
[src]

impl<T, S> Send for HashRing<T, S> where
    S: Send,
    T: Send
[src]

impl<T, S> Sync for HashRing<T, S> where
    S: Sync,
    T: Sync
[src]

impl<T, S> Unpin for HashRing<T, S> where
    S: Unpin,
    T: Unpin
[src]

impl<T, S> UnwindSafe for HashRing<T, S> where
    S: UnwindSafe,
    T: UnwindSafe
[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,