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

Method get_session_ledger

atomic-repository/src/repository/changes.rs:1374–1400  ·  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

1372 /// Unlike `find_provenance_for_session`, this reads only the session index
1373 /// and turn records; it does not scan unrelated provenance files.
1374 pub fn get_session_ledger(
1375 &self,
1376 session_id: &str,
1377 ) -> Result<
1378 Option<(
1379 atomic_core::change::session::SessionRecord,
1380 Vec<atomic_core::change::session::SessionTurn>,
1381 )>,
1382 RepositoryError,
1383 > {
1384 let txn = self
1385 .pristine
1386 .read_txn()
1387 .map_err(|e| RepositoryError::Database(e.to_string()))?;
1388 let record = txn
1389 .get_session_record(session_id)
1390 .map_err(|e| RepositoryError::Database(e.to_string()))?;
1391 match record {
1392 Some(record) => {
1393 let turns = txn
1394 .get_session_turns(session_id)
1395 .map_err(|e| RepositoryError::Database(e.to_string()))?;
1396 Ok(Some((record, turns)))
1397 }
1398 None => Ok(None),
1399 }
1400 }
1401
1402 /// List recent session ledgers, newest activity first.
1403 ///

Calls 3

read_txnMethod · 0.80
get_session_recordMethod · 0.80
get_session_turnsMethod · 0.80