Expand description
Hashing primitives, token arithmetic, and ring distributions.
The HashType enum lists every hashing algorithm offered by the
engine. hash dispatches a key to the chosen algorithm and yields a
token::DynToken that can be compared and used as a key in a
continuum.
§Examples
use dynomite::hashkit::{hash, HashType};
let token = hash(HashType::Murmur3, b"dynomite");
assert_eq!(token.len(), 4);Re-exports§
pub use crate::hashkit::random_slicing::RandomSlices;pub use crate::hashkit::random_slicing::RandomSlicesError;pub use crate::hashkit::token::DynToken;
Modules§
- ketama
- Ketama consistent-hashing continuum.
- modula
- Modula distribution: each live server contributes a number of
continuum slots equal to its weight, and dispatch is
hash % ncontinuum. - random_
slicing - Random-slicing distribution: a small, gap-free partition table over the 64-bit hash space.
- token
- Big-integer token used as the hash output and ring coordinate.
Structs§
- Pseudo
Rng - Linear congruential generator with the parameters used by glibc’s
non-secure
random()family. Sufficient for ring dispatch (the only caller); not cryptographically strong.
Enums§
- Hash
Type - All hashing algorithms supported by the engine.
Functions§
- crc32_
sz - CRC-32 over a buffer, lower-cased before mixing.
- hash
- Hash
keywith the requested algorithm and return the resulting token. - hash64
- Hash
keyand return a 64-bit value used by the random-slicing distribution table. - md5_
signature - Compute the raw 128-byte MD5 digest of
key. - murmur3_
x64_ 64 - MurmurHash3 truncated to 64 bits.