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Β§
- Append
Guard π - Guards one append to an open journal file. Unless
commitis called first, dropping the guard truncates the file to its length atbegin_append. - Journal
File π - An open journal file handle plus the path it was opened from.
FunctionsΒ§
- replace_
with π - Writes a journal containing
snapshotto the temp path ofpath, then renames it overpath. The header is left out for an empty snapshot. The rename is durable only aftersync_parent_dir. - sync_
parent_ πdir Unix - Fsyncs the directory containing
pathso that a preceding rename or create ofpathis durable across a crash. - tmp_
path_ πfor - Compaction temp path for a journal at
path: the full file name plus a.tmpsuffix. Appending (rather than replacing the extension) keeps two journals that differ only in extension from sharing a temp path. - truncate π
- Truncates
pathtonew_lenbytes and fsync. - write_
framed π - Writes the file header first if
write_header, thenpayload, then fsyncs. Shared by a plain append (AppendGuard::append_frame) and a compactionβs from-scratch temp file (Writer::compact).