pub struct Journal { /* private fields */ }Expand description
In-memory journal with optional durable path.
Maturity: core
Implementations§
Source§impl Journal
impl Journal
Sourcepub const fn new(path: Option<PathBuf>) -> Self
pub const fn new(path: Option<PathBuf>) -> Self
Empty journal, optionally bound to a path for appends.
Sourcepub fn load(path: PathBuf) -> Result<Self, JournalError>
pub fn load(path: PathBuf) -> Result<Self, JournalError>
Load from jsonl path (missing file => empty bound journal).
§Errors
Returns parse/IO/unsafe-restore errors. Torn final lines are repaired
(completed with \n when valid JSON, otherwise truncated).
Sourcepub fn agent_reservation_count(&self) -> u64
pub fn agent_reservation_count(&self) -> u64
Count of recorded spawn_agent entries (reservation accounting helper).
Sourcepub fn replay(
&self,
seq: u64,
kind: &str,
hash: &str,
) -> Result<Option<Value>, JournalError>
pub fn replay( &self, seq: u64, kind: &str, hash: &str, ) -> Result<Option<Value>, JournalError>
Sourcepub fn record(
&mut self,
seq: u64,
kind: &str,
hash: String,
result: Value,
) -> Result<(), JournalError>
pub fn record( &mut self, seq: u64, kind: &str, hash: String, result: Value, ) -> Result<(), JournalError>
Sourcepub fn prune_trailing_host_error(
&mut self,
failure_detail: &str,
) -> Result<bool, JournalError>
pub fn prune_trailing_host_error( &mut self, failure_detail: &str, ) -> Result<bool, JournalError>
Drop the trailing host-error sentinel when it matches failure_detail.
Used so a recoverable host failure can be retried on resume without replaying the same error. Safe to call repeatedly: each successful prune restores the prior entry’s line offset.
§Errors
IO failures while truncating the durable file.
Sourcepub fn prune_trailing_host_errors(
&mut self,
failure_detail: &str,
) -> Result<usize, JournalError>
pub fn prune_trailing_host_errors( &mut self, failure_detail: &str, ) -> Result<usize, JournalError>
Drop trailing host-error sentinels while failure_detail matches the
current last entry’s message (repeated prune).
§Errors
IO failures while truncating.
Sourcepub fn entries(&self) -> &[JournalEntry]
pub fn entries(&self) -> &[JournalEntry]
Entries as a slice (for inspection / tests).