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

Function vshard_for_array_coord

nodedb-cluster/src/array_routing.rs:124–129  ·  view source on GitHub ↗

Compute the vShard ID for an array op at the given coordinate. The shard key is `array_name_bytes || tile_id.to_le_bytes()`, hashed via `vshard_from_key`. Falls back to `array_vshard_for_name(array_name)` when: - `coord` / `tile_extents` are empty or mismatched. - Any `tile_extents[i]` is zero. Returns a raw `u16` in `0..1023`. Callers wrap it in `VShardId::new(…)`.

(array_name: &str, coord: &[u64], tile_extents: &[u64])

Source from the content-addressed store, hash-verified

122///
123/// Returns a raw `u16` in `0..1023`. Callers wrap it in `VShardId::new(…)`.
124pub fn vshard_for_array_coord(array_name: &str, coord: &[u64], tile_extents: &[u64]) -> u32 {
125 match tile_id_of_coord(coord, tile_extents) {
126 Some(tile_id) => vshard_for_array_tile(array_name, tile_id),
127 None => array_vshard_for_name(array_name),
128 }
129}
130
131/// Compute the vShard ID for an array tile by tile identifier.
132///

Calls 3

tile_id_of_coordFunction · 0.85
vshard_for_array_tileFunction · 0.85
array_vshard_for_nameFunction · 0.85