Make start evidence atomic and recover only bound durable outcomes
Rust development slice / linux (push) Failing after 7s

This commit is contained in:
2026-11-14 02:01:17 +01:00
parent de3b408c34
commit 74736483df
13 changed files with 764 additions and 87 deletions
+11 -1
View File
@@ -78,7 +78,7 @@ pub fn lock_state(dir: &Path, uid: u32) -> Result<fs::File> {
f.try_lock_exclusive()?;
Ok(f)
}
pub use rmm_agent_core::ledger::{bounded_journal_capacity, consume, finish};
pub use rmm_agent_core::ledger::{bounded_journal_capacity, consume, finish, persist_outcome};
pub fn open_ledger(dir: &Path, uid: u32) -> Result<rusqlite::Connection> {
use std::os::unix::fs::OpenOptionsExt;
@@ -98,6 +98,16 @@ pub fn open_ledger(dir: &Path, uid: u32) -> Result<rusqlite::Connection> {
fs::File::open(dir)?.sync_all()?;
Ok(db)
}
/// Atomically reserve and persist the exact original signed request before effect.
pub fn begin_execution(
db: &mut rusqlite::Connection,
permit: &ExecutionPermitPayload,
request: &Request,
) -> Result<()> {
let recorded_at = Utc::now();
let boot = Uuid::parse_str(&rmm_agent_linux::boot_id()?)?;
rmm_agent_core::ledger::begin_execution(db, permit, request, boot, recorded_at)
}
/// Persist the same exact request/boot/time evidence through the shared ledger.
pub fn save_start(
db: &rusqlite::Connection,