MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / get_session_todos

Method get_session_todos

atomic-core/src/pristine/txn/read.rs:1185–1209  ·  view source on GitHub ↗

Get all todos for a provenance graph. Returns snapshots of all todo items from the turn, for any agent. Empty if the provenance recorded no todos / no session data.

(
        &self,
        provenance_id: u64,
    )

Source from the content-addressed store, hash-verified

1183 /// Returns snapshots of all todo items from the turn, for any agent.
1184 /// Empty if the provenance recorded no todos / no session data.
1185 pub fn get_session_todos(
1186 &self,
1187 provenance_id: u64,
1188 ) -> PristineResult<Vec<crate::change::session::TodoSnapshot>> {
1189 use crate::change::session::{encode_session_prefix, TodoSnapshot};
1190
1191 let table = self.txn.open_table(SESSION_TODOS)?;
1192 let mut todos = Vec::new();
1193
1194 // Bounded prefix scan: all todo keys for this provenance_id lie in
1195 // [prefix(id), prefix(id+1)).
1196 let start = encode_session_prefix(provenance_id);
1197 let end = encode_session_prefix(provenance_id.saturating_add(1));
1198 for result in table.range::<&[u8; 16]>(&start..&end)? {
1199 let (_key, value) = result?;
1200 match TodoSnapshot::from_bytes(value.value()) {
1201 Ok(snapshot) => todos.push(snapshot),
1202 Err(e) => {
1203 log::warn!("Failed to deserialize todo snapshot: {}", e);
1204 }
1205 }
1206 }
1207
1208 Ok(todos)
1209 }
1210
1211 /// Get phase timing breakdown for a provenance graph.
1212 ///

Calls 3

encode_session_prefixFunction · 0.85
valueMethod · 0.80
pushMethod · 0.45