pub trait Transform: Send + Sync {
// Required methods
fn id(&self) -> &str;
fn run<'async_trait>(
self: Box<Self>,
rx: Receiver<Envelope>,
tx: Sender<Envelope>,
cancel: CancellationToken,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait;
// Provided method
fn set_node_ctx(&mut self, _ctx: NodeCtx) { ... }
}Expand description
Full-control transform: owns both channels.
Implement directly for cardinality changes or stateful work:
batching (N -> 1), flat-map (1 -> N), joins, windowed aggregation.
For plain 1 -> 0-or-1 transforms, implement MapOne instead.
Required Methods§
fn id(&self) -> &str
fn run<'async_trait>(
self: Box<Self>,
rx: Receiver<Envelope>,
tx: Sender<Envelope>,
cancel: CancellationToken,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
Provided Methods§
Sourcefn set_node_ctx(&mut self, _ctx: NodeCtx)
fn set_node_ctx(&mut self, _ctx: NodeCtx)
Attach the per-node observability context. Called by
spawn_pipeline after the transform is built but before it
runs. Default no-op — full-control transforms that want
metrics override this and store the ctx; BasicTransform
already does so for the common path.