consistent-hashing-rs 0.1.0

Consistent hashing with bounded loads implementation in Rust
Documentation
  • Coverage
  • 0%
    0 out of 13 items documented0 out of 12 items with examples
  • Size
  • Source code size: 21.53 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 586.71 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • anujsrv

License: Apache 2.0 CI

Consistent Hashing with bounded loads implementation in Rust

Consistent hashing with bounded loads implementation in Rust.

Reference - https://arxiv.org/pdf/1608.01350

Example usage

use consistenthash::{ConsistentHash, Node};

let mut ch = ConsistentHash::with_load_factor(1.25);
let replication_factor = 3;

ch.add_node(&Node::new(String::from("test_node1")), replication_factor);
ch.add_node(&Node::new(String::from("test_node2")), replication_factor);

ch.assign_key(String::from("key1"));
ch.assign_key(String::from("key2"));

println!("matched_node: {} for key: key1", ch.get_node(String::from("key1")).unwrap());