Skip to main content

SinkPlugin

Trait SinkPlugin 

Source
pub trait SinkPlugin: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn initialize(&mut self, config: &Value) -> Result<(), SynthError>;
    fn write_records(
        &mut self,
        records: &[GeneratedRecord],
    ) -> Result<usize, SynthError>;
    fn finalize(&mut self) -> Result<SinkSummary, SynthError>;
}
Expand description

Trait for custom output sink plugins.

Sink plugins write generated records to external destinations.

§Lifecycle

  1. initialize() — set up the sink (open files, connections)
  2. write_records() — write batches of records (called multiple times)
  3. finalize() — flush and close the sink, return summary

Required Methods§

Source

fn name(&self) -> &str

Unique name identifying this sink.

Source

fn initialize(&mut self, config: &Value) -> Result<(), SynthError>

Initialize the sink with configuration.

Source

fn write_records( &mut self, records: &[GeneratedRecord], ) -> Result<usize, SynthError>

Write a batch of records. Returns number of records written.

Source

fn finalize(&mut self) -> Result<SinkSummary, SynthError>

Finalize the sink and return a summary.

Implementors§