Skip to main content

LastFileReader

Struct LastFileReader 

Source
pub struct LastFileReader<F: LogFileAccess> { /* private fields */ }
Expand description

Tracks the last occurrence of specific log entry types.

Used during recovery to find checkpoint entries, etc.

Implementations§

Source§

impl<F: LogFileAccess> LastFileReader<F>

Source

pub fn new(file_access: F, read_buffer_size: usize) -> Result<Self>

Create a LastFileReader.

Automatically positions at the last good file with a complete header.

§Arguments
  • file_access - File I/O interface
  • read_buffer_size - Size of read buffer
Source

pub fn set_target_type(&mut self, entry_type: u8)

Register an entry type to track.

When entries of this type are encountered, their LSN will be recorded.

Source

pub fn set_halt_on_commit_after_checksum(&mut self, halt: bool)

Enable/disable halt-on-committed-txn-after-checksum behavior.

Recovery wires this from the config param noxu.haltOnCommitAfterChecksumException (HALT_ON_COMMIT_AFTER_CHECKSUMEXCEPTION). When enabled, a checksum failure during end-of-log discovery triggers a forward scan for a TxnCommit entry; if one is found, read_next_entry returns the fatal NoxuLogError::FoundCommittedTxn rather than silently truncating.

Faithful to JE LastFileReader.readNextEntry (LastFileReader.java:313).

Source

pub fn get_last_seen(&self, entry_type: u8) -> Lsn

Get the last LSN seen for a tracked entry type.

Returns NULL_LSN if the type was not seen.

Source

pub fn get_end_of_log(&self) -> Lsn

Get the end-of-log LSN.

This is the LSN to use for the next log entry.

Source

pub fn get_last_valid_lsn(&self) -> Lsn

Get the last valid LSN.

This is the LSN of the last successfully validated entry.

Source

pub fn get_prev_offset(&self) -> u64

Get the previous offset from the last entry.

Source

pub fn get_entry_type(&self) -> u8

Get the type of the last entry processed.

Source

pub fn read_next_entry(&mut self) -> Result<bool>

Read the next entry.

This method stops at bad entries (checksum failures) and reports them as the end of the log, rather than throwing an error.

Returns Ok(true) if an entry was read, Ok(false) at end.

Auto Trait Implementations§

§

impl<F> Freeze for LastFileReader<F>
where F: Freeze,

§

impl<F> RefUnwindSafe for LastFileReader<F>
where F: RefUnwindSafe,

§

impl<F> Send for LastFileReader<F>
where F: Send,

§

impl<F> Sync for LastFileReader<F>
where F: Sync,

§

impl<F> Unpin for LastFileReader<F>
where F: Unpin,

§

impl<F> UnsafeUnpin for LastFileReader<F>
where F: UnsafeUnpin,

§

impl<F> UnwindSafe for LastFileReader<F>
where F: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.