pub trait Operator: Send {
// Required methods
fn on_data(&mut self, edge: u32, batch: RecordBatch, out: &mut Out);
fn on_watermark(&mut self, wm: i64, now_ms: i64, out: &mut Out);
fn on_barrier(
&mut self,
epoch: u64,
out: &mut Out,
) -> Result<OpSnapshot, String>;
fn on_eos(&mut self, out: &mut Out);
// Provided method
fn on_tick(&mut self, _now_ms: i64, _out: &mut Out) { ... }
}Expand description
What a task runs. Operators are single-threaded and own their state; the runtime never calls two methods concurrently.
Required Methods§
Sourcefn on_data(&mut self, edge: u32, batch: RecordBatch, out: &mut Out)
fn on_data(&mut self, edge: u32, batch: RecordBatch, out: &mut Out)
A batch arrived on edge.
Sourcefn on_watermark(&mut self, wm: i64, now_ms: i64, out: &mut Out)
fn on_watermark(&mut self, wm: i64, now_ms: i64, out: &mut Out)
The combined input watermark advanced to wm (the minimum over all active upstream
sources); fire what it closes. now_ms is processing time.
Sourcefn on_barrier(
&mut self,
epoch: u64,
out: &mut Out,
) -> Result<OpSnapshot, String>
fn on_barrier( &mut self, epoch: u64, out: &mut Out, ) -> Result<OpSnapshot, String>
A barrier aligned on every input: snapshot the state for epoch (a small head, and any
immutable files a file-backed operator uploads once). An Err is a checkpoint the operator
could not take (a full disk, a lost spill directory): the runtime fails the build with the
message — no panic, no unwind.
Provided Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".