Skip to main content

ColumnCodec

Trait ColumnCodec 

Source
pub trait ColumnCodec: Send + Sync {
    // Required methods
    fn id(&self) -> CodecId;
    fn encode_chunk(
        &self,
        input: &[f32],
        params: &ChannelParams,
        out: &mut Vec<u8>,
    ) -> Result<EncodeStats>;
    fn decode_chunk(
        &self,
        payload: &[u8],
        params: &ChannelParams,
        out: &mut [f32],
    ) -> Result<()>;
}
Expand description

Per-chunk column codec. Implementors MUST be stateless w.r.t. encode/decode (any per-call state belongs in the payload or in ChannelParams).

Required Methods§

Source

fn id(&self) -> CodecId

Source

fn encode_chunk( &self, input: &[f32], params: &ChannelParams, out: &mut Vec<u8>, ) -> Result<EncodeStats>

Encode input events for one column into out. Returns stats describing the produced payload. out is appended to, not replaced.

Source

fn decode_chunk( &self, payload: &[u8], params: &ChannelParams, out: &mut [f32], ) -> Result<()>

Decode payload into out. out.len() MUST equal the original event count. Implementations should treat out as uninitialized and fully overwrite every element.

Implementors§