Skip to main content

encode_sink_buffer

Function encode_sink_buffer 

Source
fn encode_sink_buffer(
    buffer: Buffer,
    ipc_meta_data: &mut IpcMetadataBuilder,
    sink: &mut IpcBodySink<'_>,
    offset: i64,
    compression_codec: Option<CompressionCodec>,
    compression_context: &mut CompressionContext,
    alignment: u8,
) -> Result<i64, ArrowError>
Expand description

Encodes a single Arrow [Buffer] into the IPC body and records its metadata.

  • buffer: the Arrow data buffer to encode (validity bitmap, offsets, values, etc.)
  • buffers: in-progress list of IPC Buffer metadata entries (body offset + length) that will eventually be serialised into the flatbuffer RecordBatch header.
  • sink: destination for the actual encoded bytes; either a contiguous Vec<u8> for in-memory writes, or a list of EncodedBuffer segments for deferred zero-copy streaming.
  • offset: running byte offset into the IPC message body, used to compute the metadata entry.
  • compression_codec / compression_context: if Some, the buffer is compressed before writing; compression_context provides reusable scratch space across calls.
  • alignment: each buffer is padded to this many bytes so the next buffer starts aligned.

Returns the updated offset (advanced by the encoded length plus any alignment padding).