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

Function shard_id

nodedb/tests/array_cluster_sync.rs:37–40  ·  view source on GitHub ↗

Minimal coord-to-shard mapping. `shard = (tile_x % num_shards)` where `tile_x = coord_x / tile_extent`. Real routing in Phase I uses `nodedb_cluster::vshard_for_array_coord`.

(coord_x: i64, tile_extent: i64, num_shards: u32)

Source from the content-addressed store, hash-verified

35/// `shard = (tile_x % num_shards)` where `tile_x = coord_x / tile_extent`.
36/// Real routing in Phase I uses `nodedb_cluster::vshard_for_array_coord`.
37fn shard_id(coord_x: i64, tile_extent: i64, num_shards: u32) -> u32 {
38 let tile = coord_x / tile_extent;
39 (tile.unsigned_abs() % num_shards as u64) as u32
40}
41
42fn put_op(array: &str, coord_x: i64, ms: u64) -> ArrayOp {
43 ArrayOp {

Calls

no outgoing calls

Tested by

no test coverage detected