Skip to main content

Module file

Module file 

Available on crate feature tokio only.
Expand description

Low-level journal file primitives: the append handle, write-rollback guard, and the fsync/truncate/temp-path helpers built on std::fs.

StructsΒ§

AppendGuard πŸ”’
Guards one append to an open journal file. Unless commit is called first, dropping the guard truncates the file to its length at begin_append.
JournalFile πŸ”’
An open journal file handle plus the path it was opened from.

FunctionsΒ§

replace_with πŸ”’
Writes a journal containing snapshot to the temp path of path, then renames it over path. The header is left out for an empty snapshot. The rename is durable only after sync_parent_dir.
sync_parent_dir πŸ”’ Unix
Fsyncs the directory containing path so that a preceding rename or create of path is durable across a crash.
tmp_path_for πŸ”’
Compaction temp path for a journal at path: the full file name plus a .tmp suffix. Appending (rather than replacing the extension) keeps two journals that differ only in extension from sharing a temp path.
truncate πŸ”’
Truncates path to new_len bytes and fsync.
write_framed πŸ”’
Writes the file header first if write_header, then payload, then fsyncs. Shared by a plain append (AppendGuard::append_frame) and a compaction’s from-scratch temp file (Writer::compact).