ketama-hash-ring 11.1.0

Zero-dependency consistent hashing suite implementing Jump Consistent Hash, weighted Ketama virtual-node rings, and Google Maglev O(1) lookup tables.
Documentation
1
2
3
4
5
6
7
8
9
10
/// Google Maglev O(1) consistent hashing lookup table with minimal disruption on node changes.
#[derive(Clone, Debug)]
pub struct MaglevHash<N> {
    /// Prime lookup table size `M`.
    pub(crate) table_size: usize,
    /// Backend nodes in stable registration order.
    pub(crate) nodes: Vec<(String, N)>,
    /// Precomputed `M`-entry lookup table mapping slot -> index in `nodes`.
    pub(crate) lookup: Vec<usize>,
}