Skip to main content

Module hash

Module hash 

Source
Expand description

Key hashing and shard routing. Key hashing and shard routing.

Provides the two functions that determine which shard owns a given key: hash_key computes a fast non-cryptographic hash (ahash), and shard_for_key maps that hash to a shard index via modular arithmetic.

These functions sit on the hot path of every command dispatch, so they are #[inline] and allocation-free.

Functions§

hash_key
Hash a key to a u64 using ahash (fast, non-cryptographic).
shard_for_key
Determine which shard owns a given key.