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

Method read_files_with_priority

nodedb/src/data/io/uring_reader.rs:258–274  ·  view source on GitHub ↗

Priority-aware variant of [`read_files`]. Identical to `read_files` but records IO wait time in `metrics` under the bucket corresponding to `priority`: - `Background` / `Normal` → `TIER_LOW` - `High` → `TIER_HIGH` - `Critical` → `TIER_CRITICAL` The wait clock starts just before the first SQE submission and stops after all CQEs are reaped. File open + buffer setup

(
        &mut self,
        paths: &[&Path],
        priority: Priority,
        metrics: &IoMetrics,
    )

Source from the content-addressed store, hash-verified

256 /// after all CQEs are reaped. File open + buffer setup time is included
257 /// because it reflects the total latency seen by the caller.
258 pub fn read_files_with_priority(
259 &mut self,
260 paths: &[&Path],
261 priority: Priority,
262 metrics: &IoMetrics,
263 ) -> Vec<Vec<u8>> {
264 let tier = match priority {
265 Priority::Background | Priority::Normal => TIER_LOW,
266 Priority::High => TIER_HIGH,
267 Priority::Critical => TIER_CRITICAL,
268 };
269 let t0 = Instant::now();
270 let result = self.read_files(paths);
271 let wait_ns = t0.elapsed().as_nanos() as u64;
272 metrics.record_wait(tier, wait_ns);
273 result
274 }
275}
276
277/// Tracks which buffer a read uses.

Callers 1

read_partition_columnsFunction · 0.80

Calls 4

nowFunction · 0.85
read_filesMethod · 0.80
elapsedMethod · 0.80
record_waitMethod · 0.80

Tested by

no test coverage detected