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§
Sourcefn process(&mut self, event: &Event, ctx: &mut OperatorContext<'_>) -> OutputVec
fn process(&mut self, event: &Event, ctx: &mut OperatorContext<'_>) -> OutputVec
Process an incoming event
Sourcefn on_timer(&mut self, timer: Timer, ctx: &mut OperatorContext<'_>) -> OutputVec
fn on_timer(&mut self, timer: Timer, ctx: &mut OperatorContext<'_>) -> OutputVec
Handle timer expiration
Sourcefn checkpoint(&self) -> OperatorState
fn checkpoint(&self) -> OperatorState
Checkpoint the operator’s state
Sourcefn restore(&mut self, state: OperatorState) -> Result<(), OperatorError>
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