StreamProcessor

Trait StreamProcessor 

Source
pub trait StreamProcessor: Send + Sync {
    // Required method
    fn process_item<'life0, 'life1, 'async_trait>(
        &'life0 self,
        item: Value,
        ctx: &'life1 Context,
    ) -> Pin<Box<dyn Future<Output = RuleResult> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided method
    fn process_chunk<'life0, 'life1, 'async_trait>(
        &'life0 self,
        items: Vec<Value>,
        ctx: &'life1 Context,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Value>, RuleError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
}
Expand description

Stream processor trait

Required Methods§

Source

fn process_item<'life0, 'life1, 'async_trait>( &'life0 self, item: Value, ctx: &'life1 Context, ) -> Pin<Box<dyn Future<Output = RuleResult> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Process a single item from the stream

Provided Methods§

Source

fn process_chunk<'life0, 'life1, 'async_trait>( &'life0 self, items: Vec<Value>, ctx: &'life1 Context, ) -> Pin<Box<dyn Future<Output = Result<Vec<Value>, RuleError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Process a chunk of items (for batch operations)

Implementors§

Source§

impl<F> StreamProcessor for FilterOperator<F>
where F: Fn(&Value) -> bool + Send + Sync,

Source§

impl<F> StreamProcessor for MapOperator<F>
where F: Fn(Value) -> Value + Send + Sync,

Source§

impl<F, Fut> StreamProcessor for AsyncMapOperator<F, Fut>
where F: Fn(Value) -> Fut + Send + Sync, Fut: Future<Output = Value> + Send,

Source§

impl<F, T> StreamProcessor for FoldOperator<F, T>
where F: Fn(T, Value) -> T + Send + Sync, T: Clone + Send + Sync + Into<Value> + 'static,