Skip to main content

ConsistentHash

Trait ConsistentHash 

Source
pub trait ConsistentHash {
    // Required methods
    fn route(&self, key: &str) -> Option<NodeId>;
    fn route_replicas(&self, key: &str, count: usize) -> Vec<NodeId>;
    fn add(&mut self, node: NodeId);
    fn remove(&mut self, node: &NodeId);
}
Expand description

Trait for consistent hashing implementations.

Required Methods§

Source

fn route(&self, key: &str) -> Option<NodeId>

Get the node for a key.

Source

fn route_replicas(&self, key: &str, count: usize) -> Vec<NodeId>

Get multiple nodes for a key.

Source

fn add(&mut self, node: NodeId)

Add a node.

Source

fn remove(&mut self, node: &NodeId)

Remove a node.

Implementors§