pub struct WalReader { /* private fields */ }Expand description
Reads entries from all WAL segments in a directory.
Segments are processed in ascending segment_id order. CRC32
checksums are validated for every entry.
Implementations§
Source§impl WalReader
impl WalReader
Sourcepub fn read_all(&self) -> RaftResult<Vec<LogEntry>>
pub fn read_all(&self) -> RaftResult<Vec<LogEntry>>
Read all entries from all segments, validating CRC for every entry.
Returns an error if any corruption or CRC mismatch is detected. Accepts both WAL v1 and WAL v2 segments transparently.
Sourcepub fn recover(&self) -> RaftResult<Vec<LogEntry>>
pub fn recover(&self) -> RaftResult<Vec<LogEntry>>
Recover entries from all segments, tolerating a partial or corrupted final entry.
Complete, CRC-valid entries are returned. If the very last entry of the very last segment is incomplete or has a bad CRC it is silently discarded (crash recovery). Corruption in the middle of a segment still returns an error.
Uses CorruptionPolicy::TruncateToLastGood for backward
compatibility.
Sourcepub fn recover_with_policy(
&self,
policy: CorruptionPolicy,
) -> RaftResult<(Vec<LogEntry>, WalDiagnostics)>
pub fn recover_with_policy( &self, policy: CorruptionPolicy, ) -> RaftResult<(Vec<LogEntry>, WalDiagnostics)>
Recover entries with an explicit CorruptionPolicy.
Returns the recovered entries together with WalDiagnostics
describing what was found.
Auto Trait Implementations§
impl Freeze for WalReader
impl RefUnwindSafe for WalReader
impl Send for WalReader
impl Sync for WalReader
impl Unpin for WalReader
impl UnsafeUnpin for WalReader
impl UnwindSafe for WalReader
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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 moreSource§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.