Trait BatchProcessor

Source
pub trait BatchProcessor<In, Out = ()> {
    type Intermediate;

    // Required methods
    fn prepare_item<'life0, 'async_trait>(
        &'life0 self,
        input: In,
    ) -> Pin<Box<dyn Future<Output = Result<Self::Intermediate>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn process_batch<'life0, 'async_trait>(
        &'life0 self,
        mid: Vec<Self::Intermediate>,
    ) -> Pin<Box<dyn Future<Output = Result<Out>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}

Required Associated Types§

Required Methods§

Source

fn prepare_item<'life0, 'async_trait>( &'life0 self, input: In, ) -> Pin<Box<dyn Future<Output = Result<Self::Intermediate>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Action that does not have a special way of batching, and the caller can simply executed in parallel on many items at once.

Source

fn process_batch<'life0, 'async_trait>( &'life0 self, mid: Vec<Self::Intermediate>, ) -> Pin<Box<dyn Future<Output = Result<Out>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Action that does have a special way of batching, and this particular type can define the batching approach.

Implementors§