Skip to main content

EntryBufferWriter

Struct EntryBufferWriter 

Source
pub struct EntryBufferWriter<'a> { /* private fields */ }
Expand description

Encodes one log entry’s body: accumulates bytes while feeding a rolling blake3 hash, and deduplicates UUIDs against a dictionary shared across the segment’s entries.

Implementations§

Source§

impl<'a> EntryBufferWriter<'a>

Source

pub fn new(uuid_dict: &'a mut HashMap<Uuid, u32>) -> Self

Create a writer that shares uuid_dict for UUID dictionary compression across the entries of one segment.

Source

pub fn write_byte(&mut self, b: u8)

Append a single raw byte.

Source

pub fn write_varint(&mut self, v: u64)

Append v as an unsigned varint (7 data bits per byte, little-endian).

Source

pub fn write_blob(&mut self, data: &[u8])

Append a length-prefixed byte string: a varint length, then the bytes.

Source

pub fn write_u16_le(&mut self, v: u16)

Append a u16 in little-endian order.

Source

pub fn write_zigzag(&mut self, n: i64)

Append a signed integer as a zigzag-encoded varint.

Source

pub fn write_uuid(&mut self, data: &Uuid)

Write a UUID using dictionary compression. The canonical hash always sees the raw 16 bytes regardless of whether the buffer gets a dict reference or an inline literal.

Source

pub fn write_delta(&mut self, current: u64, last: u64) -> Result<(), CodecError>

Write a delta-encoded timestamp. Timestamps within a segment must be monotonically non-decreasing.

Source

pub fn finalize(self) -> (Vec<u8>, Hash)

Finalize the entry: appends truncated blake3 hash as integrity check bytes and returns the encoded buffer plus the full hash.

Source

pub fn into_bytes(self) -> Vec<u8>

Return just the encoded body, without the truncated-hash integrity trailer that finalize appends. Used by callers that reuse the wire encoding for storage and supply their own framing — e.g. the SQL op-log index codec, which stores the raw key/value bytes and has no use for a per-blob integrity hash.

Auto Trait Implementations§

§

impl<'a> !UnwindSafe for EntryBufferWriter<'a>

§

impl<'a> Freeze for EntryBufferWriter<'a>

§

impl<'a> RefUnwindSafe for EntryBufferWriter<'a>

§

impl<'a> Send for EntryBufferWriter<'a>

§

impl<'a> Sync for EntryBufferWriter<'a>

§

impl<'a> Unpin for EntryBufferWriter<'a>

§

impl<'a> UnsafeUnpin for EntryBufferWriter<'a>

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.