Skip to content

liutaihua/rust-ketama

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ketama rust implement

Usage

Cargo toml

[dependencies.ketama]
git = "https://github.com/liutaihua/rust-ketama"

Example

extern crate ketama;
use ketama::ketama::{HashRing};

fn main() {
    let mut ring = HashRing::new(255);
    ring.add("node1".to_string(), 1);
    ring.add("node2".to_string(), 1);
    ring.add("node3".to_string(), 1);
    ring.bake();
    let i = ring.hash("helloworld".to_string());
    println!("======= str: helloworld, hash res:{:?} ========", i);
}

test

cargo test

todo

benchmark

About

Minimal implementation of Ketama for Rust

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages