Skip to main content

Module journal

Module journal 

Source

Structs§

Journal
The write-ahead journal persisted to disk.
JournalEntry
A single file entry in the journal.

Enums§

JournalStatus
Status of the atomic batch operation recorded in the journal.

Constants§

JOURNAL_FILENAME
Name of the journal file placed in CWD (or fallback directory).
LOCK_FILENAME
Name of the lock file for concurrent execution prevention.

Functions§

delete_journal
Delete the journal file.
journal_dir
Determine the journal directory. Prefers CWD; falls back to the first target file’s parent if CWD is not writable.
perform_recovery
Perform recovery based on journal state and user flags.
persist_journal
Persist the journal atomically: write to temp file, fsync, rename. This ensures a half-written journal can never be read.
persist_journal_best_effort
Best-effort journal update (e.g., progress tracking during commit loop). Does not fsync — used for rename_completed updates where losing the latest progress on crash is acceptable.
read_journal
Read and parse a journal from disk. Returns None if the file doesn’t exist. Returns an error if the file exists but is corrupt/unparseable.
recover_forward
Forward recovery: complete the interrupted commit by renaming remaining temp files to their targets.
recover_rollback
Recover from a Committing journal by rolling back: restore backups for completed renames, delete remaining temp files, delete journal.
recover_staged
Recover from a Staged journal: delete all temp files, delete journal. No originals were touched, so this is always safe.
sha256_file
Compute SHA-256 hex digest of a file on disk.
sha256_hex
Compute SHA-256 hex digest of a byte slice.