[][src]Struct ring_rs::Ring

pub struct Ring { /* fields omitted */ }

Methods

impl Ring[src]

pub fn new(config: Config) -> Self[src]

pub fn replication_factor(&self) -> u64[src]

pub fn add(&mut self, hostname: &str)[src]

Adds a new host to the ring. If the host already added, ignore.

pub fn remove(&mut self, hostname: &str)[src]

Removes host from the ring.

pub fn get(&mut self, key: &str) -> Option<String>[src]

Locates a host for the key.

pub fn get_least(&mut self, key: &str) -> Option<String>[src]

Picks the least load host for the key.

pub fn hosts(&mut self) -> Vec<String>[src]

Lists all hosts in the ring.

pub fn set_load(&mut self, hostname: &str, load: u64)[src]

Sets the load of host to the given value.

pub fn inc_load(&mut self, hostname: &str)[src]

Increments the load of host by 1.

pub fn decr_load(&mut self, hostname: &str)[src]

Decrements the load of host by 1.

pub fn avg_load(&self) -> f64[src]

Gets the average load of ring.

Trait Implementations

impl Send for Ring[src]

impl Sync for Ring[src]

Auto Trait Implementations

impl !RefUnwindSafe for Ring

impl Unpin for Ring

impl !UnwindSafe for Ring

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> Same<T> for T

type Output = T

Should always be Self

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.