Rindle docs and package mapSkip to main content

DrainSink

Trait DrainSink 

Source
pub trait DrainSink: Send {
    // Required methods
    fn batch(&mut self, conn: ConnId, query_id: QueryId, batch: NormalizedBatch);
    fn progress(&mut self, conn: ConnId, frame: ProgressFrame);
    fn faulted(&mut self, conn: ConnId, query_id: QueryId, reason: String);

    // Provided method
    fn query_faulted(&mut self, _query_id: QueryId, _cause: FaultCause) { ... }
}
Expand description

The sink the drain delivers finished output to. Implemented by the napi layer over a ThreadsafeFunction (→ JS onEvent) and by tests over a collector. Called on the drain thread, so keep each call cheap (marshal + hand off).

Required Methods§

Source

fn batch(&mut self, conn: ConnId, query_id: QueryId, batch: NormalizedBatch)

A query’s normalized batch (the seq-0 hydrate snapshot or an incremental tick) is ready — route it to the connection that owns the query. Delivered eagerly (before the progress frame that releases it).

Source

fn progress(&mut self, conn: ConnId, frame: ProgressFrame)

A connection’s progress frame ({cv_min}) — emitted after the data frames it releases, per the poke rule.

Source

fn faulted(&mut self, conn: ConnId, query_id: QueryId, reason: String)

A query faulted on its worker (terminal): the connection should re-subscribe (re-hydrate). No further events arrive for this query_id.

Provided Methods§

Source

fn query_faulted(&mut self, _query_id: QueryId, _cause: FaultCause)

An engine query faulted — the cluster discarded its pipeline (parallel.rs fault_recover), so a consumer that owns the query’s lifecycle (e.g. a materialization manager) must arrange to re-register it; its subscribers are separately told to re-subscribe via faulted. Called once per faulted engine query, BEFORE its subscribers are notified, with the engine query id (not a subscription id) and the fault’s classification — a push-deadline bail (FOLLOWER-LAG-SHED §6.6) must reach the owner’s mode machine before the re-register decision. Default: no-op (the 1:1/napi path re-registers on the next subscribe).

Implementors§