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
initialize()— set up the sink (open files, connections)write_records()— write batches of records (called multiple times)finalize()— flush and close the sink, return summary
Required Methods§
Sourcefn initialize(&mut self, config: &Value) -> Result<(), SynthError>
fn initialize(&mut self, config: &Value) -> Result<(), SynthError>
Initialize the sink with configuration.
Sourcefn write_records(
&mut self,
records: &[GeneratedRecord],
) -> Result<usize, SynthError>
fn write_records( &mut self, records: &[GeneratedRecord], ) -> Result<usize, SynthError>
Write a batch of records. Returns number of records written.
Sourcefn finalize(&mut self) -> Result<SinkSummary, SynthError>
fn finalize(&mut self) -> Result<SinkSummary, SynthError>
Finalize the sink and return a summary.