use std::sync::Arc;
use awaken_runtime_contract::contract::commit_coordinator::CommitCoordinator;
use super::AgentRuntime;
impl AgentRuntime {
#[must_use]
pub fn with_commit_coordinator(mut self, coordinator: Arc<dyn CommitCoordinator>) -> Self {
if self.checkpoint_storage.is_none() {
self.checkpoint_storage = Some(coordinator.reader());
}
self.commit_coordinator = Some(coordinator);
self
}
#[cfg(feature = "test-utils")]
#[must_use]
pub fn with_in_memory_thread_run_store(self, store: Arc<awaken_stores::InMemoryStore>) -> Self {
let coord = awaken_stores::MemoryCommitCoordinator::wrap(store);
self.with_commit_coordinator(coord as Arc<dyn CommitCoordinator>)
}
pub fn commit_coordinator(&self) -> Option<&Arc<dyn CommitCoordinator>> {
self.commit_coordinator.as_ref()
}
}