pub struct StreamRun { /* private fields */ }Expand description
Drives one stream plan: chunks in, one concatenated output out.
Built from the NodeCatalog — a node the catalog does not know is
an error, never a silent skip. The chunk loop lives in the caller —
the plan executor locally, the worker’s WS/DataStore loops remotely —
and this type owns the per-node flow, so the state that must survive
between chunks (and between RPC messages) has a single home.
Implementations§
Source§impl StreamRun
impl StreamRun
Sourcepub fn new(node_ids: &[String], catalog: &NodeCatalog) -> Result<Self>
pub fn new(node_ids: &[String], catalog: &NodeCatalog) -> Result<Self>
Build the per-node stream state for node_ids, resolved against
the catalog. Errors on an unknown node or a step — the compiler
already refuses steps in stream plans; this is the driver’s own
line of defense.
Sourcepub fn process_chunk(
&mut self,
chunk: Value,
ctx: &mut Context,
cache: &dyn CacheStore,
) -> Result<Option<Value>>
pub fn process_chunk( &mut self, chunk: Value, ctx: &mut Context, cache: &dyn CacheStore, ) -> Result<Option<Value>>
Push one chunk through the chain. None means a barrier swallowed
it — the nodes past the barrier see nothing until Self::flush.
Sourcepub fn flush(
&mut self,
ctx: &mut Context,
cache: &dyn CacheStore,
) -> Result<Option<Value>>
pub fn flush( &mut self, ctx: &mut Context, cache: &dyn CacheStore, ) -> Result<Option<Value>>
Materialize every barrier buffer and cascade the result through the rest of the chain — a second barrier downstream receives the whole materialized value as one “chunk”, which at flush time it is.
Sourcepub fn finish(&mut self, ctx: &Context)
pub fn finish(&mut self, ctx: &Context)
Close each started node’s event bracket with its aggregate.
Sourcepub fn chunks_processed(&self) -> usize
pub fn chunks_processed(&self) -> usize
How many chunks have been pushed so far (including ones a barrier swallowed).