Skip to main content

StreamOperator

Trait StreamOperator 

Source
pub trait StreamOperator:
    Send
    + Sync
    + Debug {
    // Required methods
    fn process<'life0, 'life1, 'async_trait>(
        &'life0 self,
        input: Vec<u8>,
        ctx: &'life1 OperatorContext,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<u8>>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn name(&self) -> &str;

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

Trait for stream operators

All stream processing operators implement this trait to provide a uniform interface for processing events in the pipeline.

Required Methods§

Source

fn process<'life0, 'life1, 'async_trait>( &'life0 self, input: Vec<u8>, ctx: &'life1 OperatorContext, ) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<u8>>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Process an event and return transformed events

§Arguments
  • input - The input event data
  • ctx - Operator context with watermark and partition info
§Returns

A vector of output events (may be empty, one, or many)

Source

fn name(&self) -> &str

Get the operator name

Provided Methods§

Source

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

Called when the operator is initialized

Source

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

Called when the operator is shut down

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§