pub struct CacheEntryReader<'a> { /* private fields */ }Expand description
Reads a cache entry body, tracking an offset into the input and exposing
the entry’s type_version so implementors can branch for backward compat.
All reads are zero-copy: returned Bytes and the buffers behind decoded
RecordBatches borrow from the input allocation.
Implementations§
Source§impl<'a> CacheEntryReader<'a>
impl<'a> CacheEntryReader<'a>
Sourcepub fn new(data: &'a Bytes, offset: usize, version: u32) -> Self
pub fn new(data: &'a Bytes, offset: usize, version: u32) -> Self
Create a reader over data, starting at body byte offset, for an
entry written at version.
Sourcepub fn version(&self) -> u32
pub fn version(&self) -> u32
The type_version from the envelope. Branch on this for backward compat.
Sourcepub fn read_u8(&mut self) -> Result<u8>
pub fn read_u8(&mut self) -> Result<u8>
Read a single discriminant byte written by CacheEntryWriter::write_u8.
Sourcepub fn read_header<P: Message + Default>(&mut self) -> Result<P>
pub fn read_header<P: Message + Default>(&mut self) -> Result<P>
Read a protobuf header written by CacheEntryWriter::write_header.
Sourcepub fn read_ipc(&mut self) -> Result<RecordBatch>
pub fn read_ipc(&mut self) -> Result<RecordBatch>
Read one RecordBatch from a 64-byte-aligned IPC section.
Sourcepub fn read_ipc_batches(&mut self) -> Result<Vec<RecordBatch>>
pub fn read_ipc_batches(&mut self) -> Result<Vec<RecordBatch>>
Read all RecordBatches from a 64-byte-aligned multi-batch IPC
section written by CacheEntryWriter::write_ipc_batches.
Sourcepub fn read_raw(&mut self) -> Result<Bytes>
pub fn read_raw(&mut self) -> Result<Bytes>
Read a raw blob written by CacheEntryWriter::write_raw, zero-copy.
Sourcepub fn body(&self) -> Bytes
pub fn body(&self) -> Bytes
The not-yet-consumed body bytes as a zero-copy slice.
For a payload that carries its own framing and is parsed with the
codec’s own cursor — the read counterpart of
CacheEntryWriter::raw_writer. For structured bodies prefer
read_header / read_ipc /
read_raw.