[−][src]Struct ring_rs::Ring
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
Auto Trait Implementations
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,