OutputBatch

Trait OutputBatch 

Source
pub trait OutputBatch: Closer {
    // Required method
    fn write_batch<'life0, 'async_trait>(
        &'life0 mut self,
        message_batch: MessageBatch,
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided methods
    fn batch_size<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = usize> + Send + 'async_trait>>
       where Self: Sync + 'async_trait,
             'life0: 'async_trait { ... }
    fn interval<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Duration> + Send + 'async_trait>>
       where Self: Sync + 'async_trait,
             'life0: 'async_trait { ... }
}
Expand description

Batching output module utilized to write many messages to the output based on batch_size and provided interval. Defaults are batch_size: 500, interval: 10 seconds. The queuing mechanism is provided by the runtime and will call write_batch if the batch size has been reached, or the desired interval has passed, whichever comes first.

Required Methods§

Source

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

Write crate::MessageBatch to the output in accordance with the provided batching policy

Provided Methods§

Source

fn batch_size<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = usize> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

returns the desired size of the crate::MessageBatch to provide the the output module

Source

fn interval<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Duration> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

returns the duration of how long the runtime should wait between sending crate::MessageBatch to the output.

Implementors§