Skip to main content

EntryBufferReader

Struct EntryBufferReader 

Source
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>

Source

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.

Source

pub fn read_byte(&mut self) -> Result<u8, CodecError>

Read a single byte.

Source

pub fn read_bytes(&mut self, len: usize) -> Result<Vec<u8>, CodecError>

Read exactly len raw bytes.

Source

pub fn read_varint(&mut self) -> Result<u64, CodecError>

Read an unsigned varint (7 data bits per byte, little-endian).

Source

pub fn read_blob(&mut self) -> Result<Vec<u8>, CodecError>

Read a length-prefixed byte string (varint length, then the bytes).

Source

pub fn read_u16_le(&mut self) -> Result<u16, CodecError>

Read a little-endian u16.

Source

pub fn read_zigzag(&mut self) -> Result<i64, CodecError>

Read a zigzag-encoded signed varint.

Source

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).

Source

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.

Source

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.

Auto Trait Implementations§

§

impl<'a, R> !UnwindSafe for EntryBufferReader<'a, R>

§

impl<'a, R> Freeze for EntryBufferReader<'a, R>

§

impl<'a, R> RefUnwindSafe for EntryBufferReader<'a, R>
where R: RefUnwindSafe,

§

impl<'a, R> Send for EntryBufferReader<'a, R>
where R: Send,

§

impl<'a, R> Sync for EntryBufferReader<'a, R>
where R: Sync,

§

impl<'a, R> Unpin for EntryBufferReader<'a, R>

§

impl<'a, R> UnsafeUnpin for EntryBufferReader<'a, R>

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.