Compute the vShard that owns this op's tile. Extracts tile extents from the schema registry and casts the op's coord to `u64` for tile routing. Falls back to collection-level routing with a warning when the schema is unavailable or coord cannot be cast.
(&self, op: &ArrayOp)
| 180 | /// to `u64` for tile routing. Falls back to collection-level routing with |
| 181 | /// a warning when the schema is unavailable or coord cannot be cast. |
| 182 | pub(super) fn vshard_for_op(&self, op: &ArrayOp) -> VShardId { |
| 183 | use nodedb_array::types::coord::value::CoordValue; |
| 184 | |
| 185 | let tile_extents = self.schemas().tile_extents(&op.header.array); |
| 186 | |
| 187 | let Some(tile_extents) = tile_extents else { |
| 188 | warn!( |
| 189 | array = %op.header.array, |
| 190 | "array_inbound: schema unavailable; routing by name only" |
| 191 | ); |
| 192 | return VShardId::new(array_vshard_for_name(&op.header.array)); |
| 193 | }; |
| 194 | |
| 195 | let coord_u64: Vec<u64> = op |
| 196 | .coord |
| 197 | .iter() |
| 198 | .map(|c| match c { |
| 199 | CoordValue::Int64(v) | CoordValue::TimestampMs(v) => *v as u64, |
| 200 | CoordValue::Float64(v) => v.to_bits(), |
| 201 | CoordValue::String(_) => 0, |
| 202 | }) |
| 203 | .collect(); |
| 204 | |
| 205 | VShardId::new(vshard_for_array_coord( |
| 206 | &op.header.array, |
| 207 | &coord_u64, |
| 208 | &tile_extents, |
| 209 | )) |
| 210 | } |
| 211 | |
| 212 | /// Convert a decoded `ArrayOp` (from sync) into a `PhysicalPlan::Array` variant. |
| 213 | pub(super) fn op_to_data_plane_plan( |
no test coverage detected