chronix_engine/wal/sink.rs
1//! The file the WAL writes to.
2//!
3//! [`WalSink`] is [`DurableFile`](crate::durable::DurableFile) plus `Seek`:
4//! the WAL rewinds to a durable offset and the catalog's manifest only
5//! appends, so the seekable half is the WAL's alone. Everything else — the
6//! three file operations a rewind needs, and the test file that reports the
7//! disk full — is shared, because two copies of a fault-injection seam is two
8//! places for the *fault* to be modelled differently.
9
10use std::io::Seek;
11
12pub use crate::durable::DurableFile;
13
14/// A WAL data file: a durable file that can also seek.
15///
16/// Boxed behind the 64 KiB `BufWriter`, so the dynamic call happens once per
17/// buffer flush rather than once per record.
18pub trait WalSink: DurableFile + Seek {}
19
20impl<T: DurableFile + Seek + ?Sized> WalSink for T {}
21
22#[cfg(test)]
23pub(crate) use crate::durable::FullDiskFile as FullDiskSink;