Struct JournalWriterBuilder
pub struct JournalWriterBuilder { /* private fields */ }Expand description
Builder for JournalWriter.
Implementations§
§impl JournalWriterBuilder
impl JournalWriterBuilder
pub fn new(run_id: Uuid, encoding: Box<dyn JournalEncoding>) -> Self
pub fn new(run_id: Uuid, encoding: Box<dyn JournalEncoding>) -> Self
Create a new builder with required fields.
pub fn fsync_policy(self, policy: FsyncPolicy) -> Self
pub fn fsync_policy(self, policy: FsyncPolicy) -> Self
Set the fsync policy. Default: FsyncPolicy::EveryWrite.
pub fn mono_origin(self, origin: Instant) -> Self
pub fn mono_origin(self, origin: Instant) -> Self
Set the monotonic clock origin. Default: Instant::now() at builder creation.
pub fn caller_timestamps(self, enabled: bool) -> Self
pub fn caller_timestamps(self, enabled: bool) -> Self
Preserve caller-set ts_utc and mono_ns instead of overwriting with
wall-clock values. Required for deterministic backtest replay.
pub fn open(self, path: impl AsRef<Path>) -> Result<JournalWriter, JournalError>
pub fn open(self, path: impl AsRef<Path>) -> Result<JournalWriter, JournalError>
Open or create the journal file and build the writer.
If the file already contains records, the writer scans to find
the last seq and resumes from last_seq + 1. If a torn tail
(truncated or corrupted trailing frame) is detected, the file is
truncated to the end of the last valid frame before reopening in
append mode. This ensures the reader never encounters corruption
before subsequently appended records. Existing non-empty journals
must match the builder run_id.