Compute a vShard ID from an array name alone. Array-specific name-only fallback used by `array_sync` paths that route before a coordinate or tile extent is known. Uses the same DJB multiply-31 hash as `VShardId::from_collection_in_database`, but without the database scope — array-sync messages carry their own scoping in the op-log header and route per-array by name.
(array_name: &str)
| 40 | /// the database scope — array-sync messages carry their own scoping in the |
| 41 | /// op-log header and route per-array by name. |
| 42 | pub fn array_vshard_for_name(array_name: &str) -> u32 { |
| 43 | let hash = array_name |
| 44 | .as_bytes() |
| 45 | .iter() |
| 46 | .fold(0u32, |h, &b| h.wrapping_mul(31).wrapping_add(b as u32)); |
| 47 | hash % VSHARD_COUNT |
| 48 | } |
| 49 | |
| 50 | /// Compute a vShard ID from an arbitrary byte key. |
| 51 | /// |