[][src]Struct maglev_rs::Maglev

pub struct Maglev { /* fields omitted */ }

! # Maglev ! An implementation of the maglev consistent hashing algorithm

Implementations

impl Maglev[src]

pub fn new(backends: &Vec<String>, table_size: u64) -> Result<Maglev, &str>[src]

Creates a new hash table of table_size with given backends. The backend size should be a prime, else returns an error

pub fn get_backend(&self, idx: usize) -> Option<String>[src]

Get backend for a given index

pub fn put_backend(&mut self, backend: &String) -> Result<(), &str>[src]

Add a backend to the list. Regenerates the hashing table

pub fn remove_backend(&mut self, backend: &String) -> Result<(), &str>[src]

Remove a backend to the list. Regenerates the hashing table

Trait Implementations

impl Debug for Maglev[src]

impl PartialEq<Maglev> for Maglev[src]

impl StructuralPartialEq for Maglev[src]

Auto Trait Implementations

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.