Expand description
Tile-aware array routing — maps (array_name, coord) → vShard id.
A distributed Origin shards each array’s op-log by tile: ops for tile T of
array A land on the vShard computed from the bytes array_name || tile_id.
This spreads a large array across 1 024 vShards without any coordination
beyond the deterministic hash already used for all other shard routing.
§Key invariant
Ops for the same (array, tile) always route to the same vShard. Ops for different tiles of the same array typically route to different vShards (with high probability for arrays whose tile grid is large enough to avoid hash collisions on a 10-bit output).
§Returned type
Functions here return a raw u16 vShard ID (0..1023). Callers in the
nodedb crate wrap this in VShardId::new(…). VShardId lives in
nodedb::types which nodedb-cluster cannot depend on without creating
a circular dependency.
§Fallbacks
- Empty coord or tile_extents: fall back to
array_vshard_for_name. - Zero tile extent in any dimension: same fallback (no division by zero).
coord.len() != tile_extents.len(): fallback.
Constants§
- VSHARD_
COUNT - Number of virtual shards — must match
VShardId::COUNTinnodedb::types.
Functions§
- array_
vshard_ for_ name - Compute a vShard ID from an array name alone.
- tile_
id_ of_ coord - Compute the tile identifier for a coordinate given tile extents.
- vshard_
for_ array_ coord - Compute the vShard ID for an array op at the given coordinate.
- vshard_
for_ array_ tile - Compute the vShard ID for an array tile by tile identifier.