pub struct BinlogFile { /* private fields */ }Expand description
A MySQL binary log file reader.
Validates the magic bytes on open, parses the FORMAT_DESCRIPTION_EVENT, and provides methods to read individual events or iterate through all of them.
Implementations§
Source§impl BinlogFile
impl BinlogFile
Sourcepub fn open(path: &str) -> Result<Self, IdbError>
pub fn open(path: &str) -> Result<Self, IdbError>
Open a binlog file from the filesystem.
Validates the 4-byte magic header and reads the FORMAT_DESCRIPTION_EVENT.
Sourcepub fn from_bytes(data: Vec<u8>) -> Result<Self, IdbError>
pub fn from_bytes(data: Vec<u8>) -> Result<Self, IdbError>
Create a binlog reader from in-memory bytes (useful for WASM).
Sourcepub fn format_description(&self) -> Option<&FormatDescriptionEvent>
pub fn format_description(&self) -> Option<&FormatDescriptionEvent>
The FORMAT_DESCRIPTION_EVENT parsed from the file header, if available.
Sourcepub fn has_checksum(&self) -> bool
pub fn has_checksum(&self) -> bool
Whether CRC-32 checksums are enabled for events in this file.
Sourcepub fn read_event_at(
&mut self,
offset: u64,
) -> Result<Option<(CommonEventHeader, BinlogEvent)>, IdbError>
pub fn read_event_at( &mut self, offset: u64, ) -> Result<Option<(CommonEventHeader, BinlogEvent)>, IdbError>
Read and parse the event at the given absolute file offset.
Returns Ok(None) if the offset is at or beyond EOF. Returns the
common header and parsed event payload on success.
Sourcepub fn events(&mut self) -> BinlogEventIterator<'_> ⓘ
pub fn events(&mut self) -> BinlogEventIterator<'_> ⓘ
Return an iterator over all events in the file, starting after the magic bytes.
Each item is (file_offset, CommonEventHeader, BinlogEvent).
Auto Trait Implementations§
impl Freeze for BinlogFile
impl !RefUnwindSafe for BinlogFile
impl !Send for BinlogFile
impl !Sync for BinlogFile
impl Unpin for BinlogFile
impl UnsafeUnpin for BinlogFile
impl !UnwindSafe for BinlogFile
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