pub trait OutputSink: Send + 'static {
// Required method
fn emit(&self, output: Arc<OutputEnvelope>);
}Expand description
User-implementable trait: receives structured outputs from the pipeline.
emit() is called on a dedicated per-feed sink thread, decoupled from
the feed’s processing loop by a bounded queue. This isolation ensures
that a slow sink does not block perception.
The output arrives as Arc<OutputEnvelope> for zero-copy handoff.
Sinks that need an owned copy can call Arc::unwrap_or_clone() or
clone specific fields as needed.
emit() is wrapped in catch_unwind — a panicking sink emits a
HealthEvent::SinkPanic and the output is dropped, but the feed
continues. If a sink blocks during shutdown, a
HealthEvent::SinkTimeout is emitted and the sink thread is detached.
emit() is deliberately not async and not fallible:
- If the sink needs async I/O, it should buffer and channel internally.
- If the sink fails, it should log and drop — the perception pipeline must never block on downstream consumption.
Required Methods§
Sourcefn emit(&self, output: Arc<OutputEnvelope>)
fn emit(&self, output: Arc<OutputEnvelope>)
Receive a processed output envelope.