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

Method get_session_ledger

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

1729 /// Unlike `find_provenance_for_session`, this reads only the session index
1730 /// and turn records; it does not scan unrelated provenance files.
1731 pub fn get_session_ledger(
1732 &self,
1733 session_id: &str,
1734 ) -> Result<
1735 Option<(
1736 atomic_core::change::session::SessionRecord,
1737 Vec<atomic_core::change::session::SessionTurn>,
1738 )>,
1739 RepositoryError,
1740 > {
1741 let txn = self
1742 .pristine
1743 .read_txn()
1744 .map_err(|e| RepositoryError::Database(e.to_string()))?;
1745 let record = txn
1746 .get_session_record(session_id)
1747 .map_err(|e| RepositoryError::Database(e.to_string()))?;
1748 match record {
1749 Some(record) => {
1750 let turns = txn
1751 .get_session_turns(session_id)
1752 .map_err(|e| RepositoryError::Database(e.to_string()))?;
1753 Ok(Some((record, turns)))
1754 }
1755 None => Ok(None),
1756 }
1757 }
1758
1759 /// List recent session ledgers, newest activity first.
1760 ///

Calls 3

read_txnMethod · 0.80
get_session_recordMethod · 0.80
get_session_turnsMethod · 0.80