pub struct WalWriter { /* private fields */ }Expand description
Appends records to a WAL segment and controls the fsync durability policy.
LSNs are assigned by the caller (the engine owns the global counter); the writer only frames, appends, and syncs.
Implementations§
Source§impl WalWriter
impl WalWriter
Sourcepub fn create(path: &Path, base_lsn: Lsn) -> Result<Self>
pub fn create(path: &Path, base_lsn: Lsn) -> Result<Self>
Create a new WAL segment file and write its header. Fails if the file already exists.
Sourcepub fn open_append(path: &Path) -> Result<Self>
pub fn open_append(path: &Path) -> Result<Self>
Open an existing WAL segment for appending, validating its header. New records are written at the end of the file.
Sourcepub fn append(&mut self, codec: &dyn PageCodec, entry: &WalEntry) -> Result<()>
pub fn append(&mut self, codec: &dyn PageCodec, entry: &WalEntry) -> Result<()>
Frame and append a record, sealing its bytes with codec first (so an
encrypting codec leaves no plaintext in the log). Does not fsync; the
record is durable only after a subsequent WalWriter::sync.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for WalWriter
impl RefUnwindSafe for WalWriter
impl Send for WalWriter
impl Sync for WalWriter
impl Unpin for WalWriter
impl UnsafeUnpin for WalWriter
impl UnwindSafe for WalWriter
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more