Operator

Trait Operator 

Source
pub trait Operator<In, Out>: Send {
    // Required method
    fn process<'life0, 'async_trait>(
        &'life0 mut self,
        record: Record<In>,
    ) -> Pin<Box<dyn Future<Output = StreamResult<Vec<Record<Out>>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided methods
    fn init<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = StreamResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn on_window_trigger<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = StreamResult<Vec<Record<Out>>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn close<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = StreamResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
}
Expand description

Operator trait defines the interface for stream processing operators

Required Methods§

Source

fn process<'life0, 'async_trait>( &'life0 mut self, record: Record<In>, ) -> Pin<Box<dyn Future<Output = StreamResult<Vec<Record<Out>>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Process a single record and return zero or more output records

Provided Methods§

Source

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

Initialize the operator

Source

fn on_window_trigger<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = StreamResult<Vec<Record<Out>>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Called when a window is triggered (if windowing is enabled)

Source

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

Close the operator and release resources

Implementors§

Source§

impl<In, Out, F> Operator<In, Out> for MapOperator<In, Out, F>
where In: Send, Out: Send, F: Fn(In) -> Out + Send + Sync,

Source§

impl<T, F> Operator<T, bool> for WindowAllOperator<T, F>
where T: Clone + Send + 'static, F: Fn(&T) -> bool + Send + Sync,

Source§

impl<T, F> Operator<T, bool> for WindowAnyOperator<T, F>
where T: Clone + Send + 'static, F: Fn(&T) -> bool + Send + Sync,

Source§

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

Source§

impl<T, F> Operator<T, T> for WindowReduceOperator<T, F>
where T: Clone + Send, F: Fn(T, T) -> T + Send + Sync,