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

Method get_session_ledger

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

1272 /// Unlike `find_provenance_for_session`, this reads only the session index
1273 /// and turn records; it does not scan unrelated provenance files.
1274 pub fn get_session_ledger(
1275 &self,
1276 session_id: &str,
1277 ) -> Result<
1278 Option<(
1279 atomic_core::change::session::SessionRecord,
1280 Vec<atomic_core::change::session::SessionTurn>,
1281 )>,
1282 RepositoryError,
1283 > {
1284 let txn = self
1285 .pristine
1286 .read_txn()
1287 .map_err(|e| RepositoryError::Database(e.to_string()))?;
1288 let record = txn
1289 .get_session_record(session_id)
1290 .map_err(|e| RepositoryError::Database(e.to_string()))?;
1291 match record {
1292 Some(record) => {
1293 let turns = txn
1294 .get_session_turns(session_id)
1295 .map_err(|e| RepositoryError::Database(e.to_string()))?;
1296 Ok(Some((record, turns)))
1297 }
1298 None => Ok(None),
1299 }
1300 }
1301
1302 /// List recent session ledgers, newest activity first.
1303 ///

Calls 3

read_txnMethod · 0.80
get_session_recordMethod · 0.80
get_session_turnsMethod · 0.80