pub struct IpcWriteContext {
scratch: Vec<u8>,
reserve_scratch: bool,
fbb: FlatBufferBuilder<'static>,
compressor: Option<Compressor<'static>>,
lz4_compressor: Option<Lz4Compressor>,
}Expand description
Additional context that may be needed for compression.
In the case of zstd, this will contain the zstd context, which can be reused between subsequent
compression calls to avoid the performance overhead of initialising a new context for every
compression. In the case of lz4, this will contain the lz4 frame encoder, whose hash table and
block buffers are likewise reused. Also holds a [FlatBufferBuilder] that is reused across
IPC writes.
Fields§
§scratch: Vec<u8>§reserve_scratch: bool§fbb: FlatBufferBuilder<'static>§compressor: Option<Compressor<'static>>§lz4_compressor: Option<Lz4Compressor>Implementations§
Source§impl IpcWriteContext
impl IpcWriteContext
Sourcepub(crate) fn mut_fbb(&mut self) -> &mut FlatBufferBuilder<'static>
pub(crate) fn mut_fbb(&mut self) -> &mut FlatBufferBuilder<'static>
Get a mutable reference to the [FlatBufferBuilder] that is reused across IPC writes.
Sourcepub fn set_reserve_scratch(&mut self, reserve: bool)
pub fn set_reserve_scratch(&mut self, reserve: bool)
Set whether the scratch buffer capacity should be reserved after each encode for reuse
on the next call. Set to false for the final batch in a sequence to avoid a
pointless allocation. by default, this is set to false.
Sourcepub(crate) fn reserve_scratch_with_capacity(&mut self, additional: usize)
pub(crate) fn reserve_scratch_with_capacity(&mut self, additional: usize)
Reserve the scratch buffer capacity for reuse on the next call. This is a no-op if
reserve_scratch is set to false.