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

Method get_session_todos

atomic-core/src/pristine/txn/read.rs:692–716  ·  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

690 /// Returns snapshots of all todo items from the turn, for any agent.
691 /// Empty if the provenance recorded no todos / no session data.
692 pub fn get_session_todos(
693 &self,
694 provenance_id: u64,
695 ) -> PristineResult<Vec<crate::change::session::TodoSnapshot>> {
696 use crate::change::session::{encode_session_prefix, TodoSnapshot};
697
698 let table = self.txn.open_table(SESSION_TODOS)?;
699 let mut todos = Vec::new();
700
701 // Bounded prefix scan: all todo keys for this provenance_id lie in
702 // [prefix(id), prefix(id+1)).
703 let start = encode_session_prefix(provenance_id);
704 let end = encode_session_prefix(provenance_id.saturating_add(1));
705 for result in table.range::<&[u8; 16]>(&start..&end)? {
706 let (_key, value) = result?;
707 match TodoSnapshot::from_bytes(value.value()) {
708 Ok(snapshot) => todos.push(snapshot),
709 Err(e) => {
710 log::warn!("Failed to deserialize todo snapshot: {}", e);
711 }
712 }
713 }
714
715 Ok(todos)
716 }
717
718 /// Get phase timing breakdown for a provenance graph.
719 ///

Calls 2

encode_session_prefixFunction · 0.85
pushMethod · 0.45