Allocate the next seq for this run. Cache-backed: O(1) after first use.
(trace_root: &Path, run_id: &str)
| 63 | |
| 64 | /// Allocate the next seq for this run. Cache-backed: O(1) after first use. |
| 65 | fn next_seq(trace_root: &Path, run_id: &str) -> u32 { |
| 66 | let key = (trace_root.to_path_buf(), run_id.to_string()); |
| 67 | let cache = SEQ_CACHE.get_or_init(|| std::sync::Mutex::new(std::collections::HashMap::new())); |
| 68 | let mut guard = cache.lock().unwrap(); |
| 69 | let last = match guard.get(&key).copied() { |
| 70 | Some(v) => v, |
| 71 | None => scan_max_seq(&replies_dir(trace_root, run_id)), |
| 72 | }; |
| 73 | let next = last + 1; |
| 74 | guard.insert(key, next); |
| 75 | next |
| 76 | } |
| 77 | |
| 78 | /// Append a new reply file. Returns the assigned seq and timestamp. |
| 79 | /// |
no test coverage detected
searching dependent graphs…