Resolve the ceiling for a specific cell coordinate. Returns the raw `CeilingResult` so callers can distinguish between `Live`, `Tombstoned`, `Erased`, and `NotFound` — unlike `scan_tiles_at` which collapses Tombstoned/Erased/NotFound into "no row in output tile". Useful for testing and diagnostic code that needs the exact sentinel type.
(
&self,
coord: &[CoordValue],
system_as_of: i64,
valid_at_ms: Option<i64>,
)
| 371 | /// |
| 372 | /// Useful for testing and diagnostic code that needs the exact sentinel type. |
| 373 | pub fn ceiling_for_coord( |
| 374 | &self, |
| 375 | coord: &[CoordValue], |
| 376 | system_as_of: i64, |
| 377 | valid_at_ms: Option<i64>, |
| 378 | ) -> nodedb_array::ArrayResult<nodedb_array::query::ceiling::CeilingResult> { |
| 379 | use nodedb_array::query::ceiling::CeilingParams; |
| 380 | // Find the hilbert_prefix for this coord. |
| 381 | let hilbert_prefix = { |
| 382 | use nodedb_array::tile::tile_id_for_cell; |
| 383 | let tile = tile_id_for_cell(&self.schema, coord, 0).map_err(|e| { |
| 384 | nodedb_array::ArrayError::SegmentCorruption { |
| 385 | detail: format!("ceiling_for_coord: tile id: {e}"), |
| 386 | } |
| 387 | })?; |
| 388 | tile.hilbert_prefix |
| 389 | }; |
| 390 | let versions = self.cell_versions_for_coord(hilbert_prefix, coord, system_as_of)?; |
| 391 | let params = CeilingParams { |
| 392 | system_as_of, |
| 393 | valid_at_ms, |
| 394 | }; |
| 395 | ceiling_resolve_cell( |
| 396 | versions.iter().map(|(tid, b)| (*tid, b.as_slice())), |
| 397 | coord, |
| 398 | ¶ms, |
| 399 | ) |
| 400 | } |
| 401 | |
| 402 | /// Build a `(TileId, raw_bytes)` list for a specific `coord` across all |
| 403 | /// versions (memtable + segments), ordered newest-first by `system_from_ms`. |