Struct SegmentScanner
pub struct SegmentScanner { /* private fields */ }Expand description
Scans a segment from a growing prefix of its bytes, so recovery reads
only the valid records plus the first zero block after them instead of
the whole preallocated file. Fed the complete image, it returns exactly
what scan_segment returns.
Implementations§
§impl SegmentScanner
impl SegmentScanner
pub fn start(bytes: &[u8], complete: bool) -> Result<Option<Self>, ScanError>
pub fn start(bytes: &[u8], complete: bool) -> Result<Option<Self>, ScanError>
Reads the header. Ok(None) for a never-activated segment. A prefix
shorter than the whole file must hold at least the header block.
pub fn header(&self) -> &SegmentHeader
pub fn advance(
&mut self,
bytes: &[u8],
complete: bool,
visit: &mut dyn FnMut(Lsn, RecordBuf),
) -> Progress
pub fn advance( &mut self, bytes: &[u8], complete: bool, visit: &mut dyn FnMut(Lsn, RecordBuf), ) -> Progress
Continues the scan over bytes, the segment’s first bytes.len()
bytes (each call passes a longer prefix of the same file). complete
says bytes is the whole file. Records already visited are not
visited again.
Auto Trait Implementations§
impl Forget for SegmentScanner
impl Freeze for SegmentScanner
impl Move for SegmentScanner
impl RefUnwindSafe for SegmentScanner
impl Send for SegmentScanner
impl Sync for SegmentScanner
impl Unpin for SegmentScanner
impl UnsafeUnpin for SegmentScanner
impl UnwindSafe for SegmentScanner
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