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

Method get_session_ledger

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

1676 /// Unlike `find_provenance_for_session`, this reads only the session index
1677 /// and turn records; it does not scan unrelated provenance files.
1678 pub fn get_session_ledger(
1679 &self,
1680 session_id: &str,
1681 ) -> Result<
1682 Option<(
1683 atomic_core::change::session::SessionRecord,
1684 Vec<atomic_core::change::session::SessionTurn>,
1685 )>,
1686 RepositoryError,
1687 > {
1688 let txn = self
1689 .pristine
1690 .read_txn()
1691 .map_err(|e| RepositoryError::Database(e.to_string()))?;
1692 let record = txn
1693 .get_session_record(session_id)
1694 .map_err(|e| RepositoryError::Database(e.to_string()))?;
1695 match record {
1696 Some(record) => {
1697 let turns = txn
1698 .get_session_turns(session_id)
1699 .map_err(|e| RepositoryError::Database(e.to_string()))?;
1700 Ok(Some((record, turns)))
1701 }
1702 None => Ok(None),
1703 }
1704 }
1705
1706 /// List recent session ledgers, newest activity first.
1707 ///

Calls 3

read_txnMethod · 0.80
get_session_recordMethod · 0.80
get_session_turnsMethod · 0.80