MCPcopy Create free account
hub / github.com/RetypeOS/parcode / hash_key

Function hash_key

src/map.rs:43–50  ·  view source on GitHub ↗

Computes a 64-bit hash of a key using the xxHash algorithm. This hash function is used to: 1. Determine which shard a key-value pair belongs to (via modulo) 2. Enable fast lookups by storing the hash alongside the data # Arguments `key` - The key to hash # Returns A 64-bit hash value

(key: &K)

Source from the content-addressed store, hash-verified

41/// # Returns
42/// A 64-bit hash value
43pub(crate) fn hash_key<K>(key: &K) -> u64
44where
45 K: Hash,
46{
47 let mut hasher = XxHash64::with_seed(0);
48 key.hash(&mut hasher);
49 hasher.finish()
50}
51
52/// Serialization job for a single `HashMap` shard.
53///

Callers 4

getMethod · 0.85
get_lazyMethod · 0.85
visitMethod · 0.85
executeMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected