pub trait OneInOneOut<S, T, U>: Send + Sync where
S: State,
T: Data + for<'a> Deserialize<'a>,
U: Data + for<'a> Deserialize<'a>, {
fn on_data(&mut self, ctx: &mut OneInOneOutContext<'_, S, U>, data: &T);
fn on_watermark(&mut self, ctx: &mut OneInOneOutContext<'_, S, U>);
fn setup(&mut self, setup_context: &mut SetupContext<S>) { ... }
fn run(
&mut self,
config: &OperatorConfig,
read_stream: &mut ReadStream<T>,
write_stream: &mut WriteStream<U>
) { ... }
fn destroy(&mut self) { ... }
}
Expand description
The OneInOneOut
trait must be implemented by operators that consume data from their input
read stream, and generate output on an output write stream. The operator can either choose to
consume data from its read_stream
itself using the run
method, or register for the
on_data
and on_watermark
callbacks.
The callbacks registered in this operator execute sequentially by timestamp order and are allowed to mutate state in both the message and the watermark callbacks.