Skip to main content

BatchingSinkWriter

Trait BatchingSinkWriter 

Source
pub trait BatchingSinkWriter: Send + 'static {
    // Required methods
    fn write_batch<'life0, 'async_trait>(
        &'life0 mut self,
        chunk: StreamChunk,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn try_commit<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn commit_on_barrier<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

A sink writer that buffers rows across chunks and commits them in batches, driven by BatchingLogSinker.

Required Methods§

Source

fn write_batch<'life0, 'async_trait>( &'life0 mut self, chunk: StreamChunk, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn try_commit<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Commits buffered data if a batch is ready. Returning true means everything received so far is visible downstream, allowing the log store to truncate up to this point.

Source

fn commit_on_barrier<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Called at a barrier. Returns whether the barrier may be truncated, i.e. everything received so far is committed or was never buffered. Batching across barriers by returning false while data is pending is only safe for sinks guaranteed to run decoupled: on the in-memory log store, an untruncated checkpoint barrier blocks the checkpoint from completing. Sinks that may run non-decoupled must flush here and return true.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§