MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / partition_hash

Function partition_hash

nodedb-cluster/src/routing.rs:296–298  ·  view source on GitHub ↗

Hash `key` using the algorithm recorded in the cluster's [`PlacementHashId`]. Callers load the `PlacementHashId` from `ClusterSettings` once at startup and pass it through every shard-split / shuffle operation. The underlying implementations live in [`crate::catalog::placement_hash`]; this function is the routing-layer entry point so callers do not need to import the catalog module directly.

(placement_hash_id: crate::catalog::PlacementHashId, key: &str)

Source from the content-addressed store, hash-verified

294/// [`crate::catalog::placement_hash`]; this function is the routing-layer
295/// entry point so callers do not need to import the catalog module directly.
296pub fn partition_hash(placement_hash_id: crate::catalog::PlacementHashId, key: &str) -> u64 {
297 crate::catalog::placement_hash(placement_hash_id, key.as_bytes())
298}
299
300#[cfg(test)]
301mod tests {

Calls 2

placement_hashFunction · 0.85
as_bytesMethod · 0.45

Tested by 1