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

Method get_session_phases

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

Get phase timing breakdown for a provenance graph. Returns timing data for each phase in 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

612 /// Returns timing data for each phase in the turn.
613 /// Empty if the provenance is not Sherpa or has no session data.
614 pub fn get_session_phases(
615 &self,
616 provenance_id: u64,
617 ) -> PristineResult<Vec<crate::change::session::PhaseTimingEntry>> {
618 use crate::change::session::{encode_session_prefix, PhaseTimingEntry};
619
620 let table = self.txn.open_table(SESSION_PHASES)?;
621 let mut phases = Vec::new();
622
623 // Bounded prefix scan: all phase keys for this provenance_id lie in
624 // [prefix(id), prefix(id+1)).
625 let start = encode_session_prefix(provenance_id);
626 let end = encode_session_prefix(provenance_id.saturating_add(1));
627 for result in table.range::<&[u8; 16]>(&start..&end)? {
628 let (_key, value) = result?;
629 match PhaseTimingEntry::from_bytes(value.value()) {
630 Ok(entry) => phases.push(entry),
631 Err(e) => {
632 log::warn!("Failed to deserialize phase timing entry: {}", e);
633 }
634 }
635 }
636
637 Ok(phases)
638 }
639
640 /// Get intent metadata for a provenance graph.
641 ///

Callers

nothing calls this directly

Calls 2

encode_session_prefixFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected