Skip to main content

Operator

Trait Operator 

Source
pub trait Operator: Send {
    // Required methods
    fn process(
        &mut self,
        event: &Event,
        ctx: &mut OperatorContext<'_>,
    ) -> OutputVec;
    fn on_timer(
        &mut self,
        timer: Timer,
        ctx: &mut OperatorContext<'_>,
    ) -> OutputVec;
    fn checkpoint(&self) -> OperatorState;
    fn restore(&mut self, state: OperatorState) -> Result<(), OperatorError>;
}
Expand description

Trait implemented by all streaming operators

Required Methods§

Source

fn process(&mut self, event: &Event, ctx: &mut OperatorContext<'_>) -> OutputVec

Process an incoming event

Source

fn on_timer(&mut self, timer: Timer, ctx: &mut OperatorContext<'_>) -> OutputVec

Handle timer expiration

Source

fn checkpoint(&self) -> OperatorState

Checkpoint the operator’s state

Source

fn restore(&mut self, state: OperatorState) -> Result<(), OperatorError>

Restore from a checkpoint

§Errors

Returns OperatorError::StateAccessFailed if the state cannot be accessed Returns OperatorError::SerializationFailed if the state cannot be deserialized

Implementors§