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

Method get_session_ledger

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

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

Calls 3

read_txnMethod · 0.80
get_session_recordMethod · 0.80
get_session_turnsMethod · 0.80