pub struct WalReader { /* private fields */ }Expand description
Streaming reader used by recovery. Stops at the first torn record
(REC_LEN == 0) or CRC mismatch, returning the cleanly-committed prefix.
Implementations§
Source§impl WalReader
impl WalReader
pub fn open(path: impl AsRef<Path>) -> Result<Self>
Sourcepub fn open_with_cipher(
path: impl AsRef<Path>,
cipher: Option<Box<dyn Cipher>>,
) -> Result<Self>
pub fn open_with_cipher( path: impl AsRef<Path>, cipher: Option<Box<dyn Cipher>>, ) -> Result<Self>
Open a WAL segment for reading, optionally with a decryption cipher.
Sourcepub fn next_record(&mut self) -> Result<Option<Record>>
pub fn next_record(&mut self) -> Result<Option<Record>>
Read the next record. Returns Ok(None) at a clean end-of-records
(zero-length marker or EOF), and Err(TornWrite) for a partial record.
Sourcepub fn replay(&mut self) -> Result<Vec<Record>>
pub fn replay(&mut self) -> Result<Vec<Record>>
Replay all cleanly-committed records. A torn tail (crash mid-append or a
partially-flushed last frame) is treated as end-of-log and truncated —
the valid prefix is returned. A CRC failure or short read that is
followed by a well-formed frame is treated as interior corruption
and surfaces as MongrelError::CorruptWal (spec §8.4, review fix #22).
Sourcepub fn current_offset(&self) -> u64
pub fn current_offset(&self) -> u64
Position the write cursor at end of file (for a reopen-and-append path, to be implemented alongside segment rotation).
Auto Trait Implementations§
impl !RefUnwindSafe for WalReader
impl !UnwindSafe for WalReader
impl Freeze for WalReader
impl Send for WalReader
impl Sync for WalReader
impl Unpin for WalReader
impl UnsafeUnpin for WalReader
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more