MCPcopy Index your code
hub / github.com/AI45Lab/Code / replace_snapshots

Method replace_snapshots

core/src/subagent_task_tracker.rs:322–330  ·  view source on GitHub ↗

Replace the tracker's task snapshots with the given set. Cancellers are **not** restored (they are runtime-only channels tied to live child loops). After `replace_snapshots`, any task whose status was `Running` at checkpoint time will appear `Running` in the tracker but `cancel(task_id)` will return `false` because no canceller is registered — callers should normally checkpoint at a quiescent poin

(&self, snapshots: Vec<SubagentTaskSnapshot>)

Source from the content-addressed store, hash-verified

320 /// restore the materialized subagent view of a previously-saved
321 /// session.
322 pub async fn replace_snapshots(&self, snapshots: Vec<SubagentTaskSnapshot>) {
323 let mut map = HashMap::with_capacity(snapshots.len());
324 for snap in snapshots {
325 map.insert(snap.task_id.clone(), snap);
326 }
327 *self.tasks.write().await = map;
328 // Cancellers reference live tokens — invalidate the lot.
329 self.cancellers.write().await.clear();
330 }
331}
332
333fn now_ms() -> u64 {

Callers 1

Calls 5

writeMethod · 0.80
lenMethod · 0.45
insertMethod · 0.45
cloneMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected