pub struct EntryBufferReader<'a, R> { /* private fields */ }Expand description
Decodes one log entry’s body — the read counterpart to
EntryBufferWriter. Feeds bytes through
the rolling hash and resolves dictionary-compressed UUIDs.
Implementations§
Source§impl<'a, R: BufRead> EntryBufferReader<'a, R>
impl<'a, R: BufRead> EntryBufferReader<'a, R>
Sourcepub fn new(
reader: &'a mut Reader<R>,
uuid_dict: &'a mut HashMap<u32, Uuid>,
) -> Self
pub fn new( reader: &'a mut Reader<R>, uuid_dict: &'a mut HashMap<u32, Uuid>, ) -> Self
Wrap reader, sharing uuid_dict to resolve UUID dictionary references
across the entries of one segment.
Sourcepub fn read_byte(&mut self) -> Result<u8, CodecError>
pub fn read_byte(&mut self) -> Result<u8, CodecError>
Read a single byte.
Sourcepub fn read_bytes(&mut self, len: usize) -> Result<Vec<u8>, CodecError>
pub fn read_bytes(&mut self, len: usize) -> Result<Vec<u8>, CodecError>
Read exactly len raw bytes.
Sourcepub fn read_varint(&mut self) -> Result<u64, CodecError>
pub fn read_varint(&mut self) -> Result<u64, CodecError>
Read an unsigned varint (7 data bits per byte, little-endian).
Sourcepub fn read_blob(&mut self) -> Result<Vec<u8>, CodecError>
pub fn read_blob(&mut self) -> Result<Vec<u8>, CodecError>
Read a length-prefixed byte string (varint length, then the bytes).
Sourcepub fn read_u16_le(&mut self) -> Result<u16, CodecError>
pub fn read_u16_le(&mut self) -> Result<u16, CodecError>
Read a little-endian u16.
Sourcepub fn read_zigzag(&mut self) -> Result<i64, CodecError>
pub fn read_zigzag(&mut self) -> Result<i64, CodecError>
Read a zigzag-encoded signed varint.
Sourcepub fn read_delta(&mut self, last: u64) -> Result<u64, CodecError>
pub fn read_delta(&mut self, last: u64) -> Result<u64, CodecError>
Read a delta-encoded timestamp. The wire stores the difference
from last; the canonical hash sees the full absolute timestamp
as fixed 8-byte little-endian (matching the writer).
Sourcepub fn read_uuid(&mut self) -> Result<Uuid, CodecError>
pub fn read_uuid(&mut self) -> Result<Uuid, CodecError>
Read a UUID, resolving dictionary compression: a 0 sentinel means the
16 bytes follow inline (and are registered for later reuse); any other
value is a 1-based index into the segment’s UUID dictionary.
Sourcepub fn finalize(self) -> Result<Hash, CodecError>
pub fn finalize(self) -> Result<Hash, CodecError>
Verify the trailing 4-byte hash check against the canonical content hash. Returns the full hash on success.