pub struct CacheEntryWriter<'a> { /* private fields */ }Expand description
Writes a cache entry body: a header followed by sections, streaming directly to the underlying writer.
The envelope is written by the CacheCodec wrapper
before this writer is handed to
CacheCodecImpl::serialize.
Implementations§
Source§impl<'a> CacheEntryWriter<'a>
impl<'a> CacheEntryWriter<'a>
Sourcepub fn new(writer: &'a mut dyn Write) -> Self
pub fn new(writer: &'a mut dyn Write) -> Self
Create a writer positioned at the start of an entry (offset 0).
Use this for nested serialization into a standalone buffer. The
envelope-aware entry point is CacheCodec::serialize.
Sourcepub fn write_u8(&mut self, value: u8) -> Result<()>
pub fn write_u8(&mut self, value: u8) -> Result<()>
Write a single discriminant byte (e.g. a variant tag).
Sourcepub fn write_header<P: Message>(&mut self, header: &P) -> Result<()>
pub fn write_header<P: Message>(&mut self, header: &P) -> Result<()>
Write a protobuf header as [len: u32 LE][bytes].
Sourcepub fn write_ipc(&mut self, batch: &RecordBatch) -> Result<()>
pub fn write_ipc(&mut self, batch: &RecordBatch) -> Result<()>
Write batch as a 64-byte-aligned Arrow IPC section.
Sourcepub fn write_ipc_batches<I>(&mut self, batches: I) -> Result<()>where
I: IntoIterator<Item = RecordBatch>,
pub fn write_ipc_batches<I>(&mut self, batches: I) -> Result<()>where
I: IntoIterator<Item = RecordBatch>,
Write batches as a single 64-byte-aligned multi-batch Arrow IPC
section. The iterator must yield at least one batch.
Sourcepub fn write_raw(&mut self, bytes: &[u8]) -> Result<()>
pub fn write_raw(&mut self, bytes: &[u8]) -> Result<()>
Write a raw blob as [len: u64 LE][bytes].
Only for byte payloads that already have their own stable, portable encoding (e.g. a roaring bitmap, a varint-packed stream).
Sourcepub fn raw_writer(&mut self) -> &mut dyn Write
pub fn raw_writer(&mut self) -> &mut dyn Write
The underlying writer, for a payload that carries its own framing.
Use this only when the codec writes a self-delimiting or whole-body
payload — e.g. streaming a roaring bitmap as the entire body, where the
length prefix of write_raw would be redundant and
buffering to measure that length would force an extra copy. For
structured bodies prefer write_header /
write_ipc / write_raw, which
give you versioning and 64-byte IPC alignment.
Bytes written through this do not advance the section-alignment
position, so it must not be interleaved with write_ipc.