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

Method get_session_todos

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

Get all todos for a provenance graph. Returns snapshots of all todo items from the turn. Empty if the provenance is not Sherpa or has no session data.

(
        &self,
        provenance_id: u64,
    )

Source from the content-addressed store, hash-verified

582 /// Returns snapshots of all todo items from the turn.
583 /// Empty if the provenance is not Sherpa or has no session data.
584 pub fn get_session_todos(
585 &self,
586 provenance_id: u64,
587 ) -> PristineResult<Vec<crate::change::session::TodoSnapshot>> {
588 use crate::change::session::{encode_session_prefix, TodoSnapshot};
589
590 let table = self.txn.open_table(SESSION_TODOS)?;
591 let mut todos = Vec::new();
592
593 // Bounded prefix scan: all todo keys for this provenance_id lie in
594 // [prefix(id), prefix(id+1)).
595 let start = encode_session_prefix(provenance_id);
596 let end = encode_session_prefix(provenance_id.saturating_add(1));
597 for result in table.range::<&[u8; 16]>(&start..&end)? {
598 let (_key, value) = result?;
599 match TodoSnapshot::from_bytes(value.value()) {
600 Ok(snapshot) => todos.push(snapshot),
601 Err(e) => {
602 log::warn!("Failed to deserialize todo snapshot: {}", e);
603 }
604 }
605 }
606
607 Ok(todos)
608 }
609
610 /// Get phase timing breakdown for a provenance graph.
611 ///

Callers

nothing calls this directly

Calls 2

encode_session_prefixFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected