FNV-1a 64-bit hash for deterministic key partitioning. Used by distributed join shuffle and shard split to assign keys to partitions. NOT for vShard routing — use `vshard_for_collection` for that.
(key: &str)
| 278 | /// to partitions. NOT for vShard routing — use `vshard_for_collection` |
| 279 | /// for that. |
| 280 | pub fn fnv1a_hash(key: &str) -> u64 { |
| 281 | let mut hash: u64 = 0xcbf29ce484222325; |
| 282 | for byte in key.as_bytes() { |
| 283 | hash ^= *byte as u64; |
| 284 | hash = hash.wrapping_mul(0x100000001b3); |
| 285 | } |
| 286 | hash |
| 287 | } |
| 288 | |
| 289 | /// Hash `key` using the algorithm recorded in the cluster's [`PlacementHashId`]. |
| 290 | /// |
no test coverage detected