Crate maglev [−] [src]
Maglev hashing - A consistent hashing algorithm from Google
Maglev: A Fast and Reliable Software Network Load Balancer
Example
use maglev::*; let m = Maglev::new(&["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"][..]); assert_eq!(*m.get(&"alice"), "Friday"); assert_eq!(*m.get(&"bob"), "Wednesday"); // When the node list changed, ensure to use same `capacity` to rebuild the lookup table. let m = Maglev::with_capacity(&["Monday", // "Tuesday", "Wednesday", // "Thursday", "Friday", "Saturday", "Sunday"][..], m.capacity()); assert_eq!(*m.get(&"alice"), "Friday"); assert_eq!(*m.get(&"bob"), "Wednesday");
Structs
Maglev |
Maglev lookup table |
Traits
ConsistentHasher |
Consistent hasher is a special kind of hashing such that when a hash table is resized,
only |