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

Method get_session_todos

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

735 /// Returns snapshots of all todo items from the turn, for any agent.
736 /// Empty if the provenance recorded no todos / no session data.
737 pub fn get_session_todos(
738 &self,
739 provenance_id: u64,
740 ) -> PristineResult<Vec<crate::change::session::TodoSnapshot>> {
741 use crate::change::session::{encode_session_prefix, TodoSnapshot};
742
743 let table = self.txn.open_table(SESSION_TODOS)?;
744 let mut todos = Vec::new();
745
746 // Bounded prefix scan: all todo keys for this provenance_id lie in
747 // [prefix(id), prefix(id+1)).
748 let start = encode_session_prefix(provenance_id);
749 let end = encode_session_prefix(provenance_id.saturating_add(1));
750 for result in table.range::<&[u8; 16]>(&start..&end)? {
751 let (_key, value) = result?;
752 match TodoSnapshot::from_bytes(value.value()) {
753 Ok(snapshot) => todos.push(snapshot),
754 Err(e) => {
755 log::warn!("Failed to deserialize todo snapshot: {}", e);
756 }
757 }
758 }
759
760 Ok(todos)
761 }
762
763 /// Get phase timing breakdown for a provenance graph.
764 ///

Calls 2

encode_session_prefixFunction · 0.85
pushMethod · 0.45