Skip to main content

Operator

Trait Operator 

Source
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§

Source

fn on_data(&mut self, edge: u32, batch: RecordBatch, out: &mut Out)

A batch arrived on edge.

Source

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.

Source

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.

Source

fn on_eos(&mut self, out: &mut Out)

Every input is done: flush.

Provided Methods§

Source

fn on_tick(&mut self, _now_ms: i64, _out: &mut Out)

Processing time passed with no data (see Msg::Tick): idle timers and processing-time windows advance here.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§