Skip to main content

Encoder

Trait Encoder 

Source
pub trait Encoder: Send + Sync {
    // Required method
    fn encode(&self, batch: &EventBatch) -> Result<Bytes>;

    // Provided method
    fn encode_individual(&self, batch: &EventBatch) -> Result<Vec<Bytes>> { ... }
}
Expand description

A trait for components that convert an EventBatch into a byte stream.

Required Methods§

Source

fn encode(&self, batch: &EventBatch) -> Result<Bytes>

Encodes a single EventBatch into a single byte stream. This is typically used for batch-oriented sinks like S3 or GCS.

Provided Methods§

Source

fn encode_individual(&self, batch: &EventBatch) -> Result<Vec<Bytes>>

Encodes an EventBatch into multiple independent byte streams (one per event). This is typically used for message-oriented sinks like Kafka. Default implementation just returns a single Vec with the output of encode.

Implementors§