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

Method get_session_ledger

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

Read the Atomic-native indexed ledger for a session. Unlike `find_provenance_for_session`, this reads only the session index and turn records; it does not scan unrelated provenance files.

(
        &self,
        session_id: &str,
    )

Source from the content-addressed store, hash-verified

1296 /// Unlike `find_provenance_for_session`, this reads only the session index
1297 /// and turn records; it does not scan unrelated provenance files.
1298 pub fn get_session_ledger(
1299 &self,
1300 session_id: &str,
1301 ) -> Result<
1302 Option<(
1303 atomic_core::change::session::SessionRecord,
1304 Vec<atomic_core::change::session::SessionTurn>,
1305 )>,
1306 RepositoryError,
1307 > {
1308 let txn = self
1309 .pristine
1310 .read_txn()
1311 .map_err(|e| RepositoryError::Database(e.to_string()))?;
1312 let record = txn
1313 .get_session_record(session_id)
1314 .map_err(|e| RepositoryError::Database(e.to_string()))?;
1315 match record {
1316 Some(record) => {
1317 let turns = txn
1318 .get_session_turns(session_id)
1319 .map_err(|e| RepositoryError::Database(e.to_string()))?;
1320 Ok(Some((record, turns)))
1321 }
1322 None => Ok(None),
1323 }
1324 }
1325
1326 /// List recent session ledgers, newest activity first.
1327 ///

Calls 3

read_txnMethod · 0.80
get_session_recordMethod · 0.80
get_session_turnsMethod · 0.80