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

Method has_session_data

atomic-repository/src/repository/changes.rs:1854–1868  ·  view source on GitHub ↗

Check if a provenance graph has populated session data. Returns `true` when the graph has at least one indexed session event (every provenance node produces one, for any agent). This is a fast gate for the UI. Note it is intentionally broader than [`Self::get_session_intent`]: a generic agent graph whose Goal node carries no intent `detail` still has session data (events, todos).

(&self, provenance_hash: &Hash)

Source from the content-addressed store, hash-verified

1852 /// [`Self::get_session_intent`]: a generic agent graph whose Goal node
1853 /// carries no intent `detail` still has session data (events, todos).
1854 pub fn has_session_data(&self, provenance_hash: &Hash) -> bool {
1855 let txn = match self.pristine.read_txn() {
1856 Ok(t) => t,
1857 Err(_) => return false,
1858 };
1859
1860 let provenance_id = match txn.get_internal(provenance_hash) {
1861 Ok(Some(id)) => id.get(),
1862 _ => return false,
1863 };
1864
1865 txn.get_session_events(provenance_id)
1866 .map(|events| !events.is_empty())
1867 .unwrap_or(false)
1868 }
1869}
1870
1871#[cfg(unix)]

Callers

nothing calls this directly

Calls 5

read_txnMethod · 0.80
getMethod · 0.65
get_internalMethod · 0.45
get_session_eventsMethod · 0.45
is_emptyMethod · 0.45

Tested by

no test coverage detected