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>, }