| 219 | } |
| 220 | |
| 221 | pub async fn records(&self) -> Vec<RunRecord> { |
| 222 | let snapshots = self.runs.read().await.values().cloned().collect::<Vec<_>>(); |
| 223 | let events = self.events.read().await; |
| 224 | let mut records = snapshots |
| 225 | .into_iter() |
| 226 | .map(|snapshot| RunRecord { |
| 227 | events: events.get(&snapshot.id).cloned().unwrap_or_default(), |
| 228 | snapshot, |
| 229 | }) |
| 230 | .collect::<Vec<_>>(); |
| 231 | records.sort_by_key(|record| record.snapshot.created_at_ms); |
| 232 | records |
| 233 | } |
| 234 | |
| 235 | pub async fn replace_records(&self, records: Vec<RunRecord>) { |
| 236 | // Preserve creation-order in the FIFO eviction queue so a |