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

Function find_tile_index

nodedb-array/src/query/retention.rs:319–327  ·  view source on GitHub ↗

Locate the position of a tile with `tile_id` in the reader's footer.

(reader: &SegmentReader<'_>, tile_id: TileId)

Source from the content-addressed store, hash-verified

317
318/// Locate the position of a tile with `tile_id` in the reader's footer.
319fn find_tile_index(reader: &SegmentReader<'_>, tile_id: TileId) -> ArrayResult<usize> {
320 reader
321 .tiles()
322 .iter()
323 .position(|e| e.tile_id == tile_id)
324 .ok_or_else(|| ArrayError::SegmentCorruption {
325 detail: format!("find_tile_index: TileId {tile_id:?} not found in segment"),
326 })
327}
328
329// ── Tests ────────────────────────────────────────────────────────────────────
330

Callers 1

merge_for_retentionFunction · 0.85

Calls 2

tilesMethod · 0.80
iterMethod · 0.45

Tested by

no test coverage detected