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

Function array_vshard_for_tile

nodedb-cluster/src/distributed_array/routing.rs:33–37  ·  view source on GitHub ↗

Determine the primary owning vShard for a single tile identified by its raw Hilbert-prefix value. `hilbert_prefix` — the tile's u64 Hilbert key. `prefix_bits` — number of high-order bits used for routing (1–16). Returns the vShard ID in `[0, VSHARD_COUNT)`.

(hilbert_prefix: u64, prefix_bits: u8)

Source from the content-addressed store, hash-verified

31///
32/// Returns the vShard ID in `[0, VSHARD_COUNT)`.
33pub fn array_vshard_for_tile(hilbert_prefix: u64, prefix_bits: u8) -> Result<u32> {
34 validate_prefix_bits(prefix_bits)?;
35 let bucket = prefix_bucket(hilbert_prefix, prefix_bits);
36 Ok(bucket_to_vshard(bucket, prefix_bits))
37}
38
39/// Determine all vShards that intersect a set of Hilbert-prefix ranges.
40///

Callers 9

partition_put_cellsFunction · 0.85
partition_delete_coordsFunction · 0.85
expected_vshardFunction · 0.85
validate_put_routingFunction · 0.85
validate_delete_routingFunction · 0.85

Calls 3

validate_prefix_bitsFunction · 0.85
prefix_bucketFunction · 0.85
bucket_to_vshardFunction · 0.85