pub struct BinlogReader<R: Read> { /* private fields */ }Expand description
Sequential reader over a .binlog stream.
Opens the binlog header, decompresses the GZip body, and yields typed
BinlogEvent values one at a time via next_event.
Auxiliary records (string table entries, name-value lists, embedded archives) are ingested automatically and are accessible through the corresponding accessor methods.
Implementations§
Source§impl<R: Read> BinlogReader<R>
impl<R: Read> BinlogReader<R>
Sourcepub fn open(reader: R) -> Result<Self, MuninError>
pub fn open(reader: R) -> Result<Self, MuninError>
Open a binlog stream and prepare for sequential reading.
Reads the uncompressed header, validates the format version, and sets up GZip decompression for the record body.
Sourcepub fn header(&self) -> &BinlogHeader
pub fn header(&self) -> &BinlogHeader
The parsed binlog file header.
Sourcepub fn strings(&self) -> &StringTable
pub fn strings(&self) -> &StringTable
The string table accumulated so far.
Sourcepub fn nvl_table(&self) -> &NameValueListTable
pub fn nvl_table(&self) -> &NameValueListTable
The name-value list table accumulated so far.
Sourcepub fn archives(&self) -> &[Vec<u8>]
pub fn archives(&self) -> &[Vec<u8>]
Embedded zip archives read from ProjectImportArchive records.
Sourcepub fn extract_archives(&self) -> Result<Vec<ArchiveEntry>, MuninError>
pub fn extract_archives(&self) -> Result<Vec<ArchiveEntry>, MuninError>
Extract all files from all embedded ProjectImportArchive zip archives.
Returns a list of (path, contents) pairs. Paths are as stored in the
zip (typically relative project file paths). If a zip entry cannot be
read (e.g. unsupported compression), that entry is silently skipped.
Sourcepub fn next_event(&mut self) -> Result<Option<BinlogEvent>, MuninError>
pub fn next_event(&mut self) -> Result<Option<BinlogEvent>, MuninError>
Read the next build event from the stream.
Returns Ok(None) when the EndOfFile record is reached.
Auxiliary records (String, NameValueList, ProjectImportArchive) are ingested internally and do not produce events. Unknown record kinds are silently skipped (forward-compatibility).
Sourcepub fn read_all_events(&mut self) -> Result<Vec<BinlogEvent>, MuninError>
pub fn read_all_events(&mut self) -> Result<Vec<BinlogEvent>, MuninError>
Collect all remaining events into a Vec.
Reads events until EndOfFile is reached. Auxiliary records are
ingested along the way.