Skip to main content

Module processor

Module processor 

Source
Expand description

The FrameProcessor trait + the channel-runtime building blocks (PROCESSOR-DESIGN §2).

Each processor runs in its own tokio task fed by a bounded mpsc channel (Data/Control) plus an unbounded mpsc channel (System frames jump the queue). The framework owns the task loop (runtime::run_processor); an impl only writes FrameProcessor::process_frame (and optional start/stop hooks).

Re-exports§

pub use runtime::run_processor;
pub use runtime::ProcessorRx;
pub use runtime::ProcessorTx;

Modules§

frame
The pipeline Frame taxonomy (PROCESSOR-DESIGN §1).
metrics
Metrics carried on Frame::Metrics.
runtime
The framework-owned per-processor task loop (PROCESSOR-DESIGN §2.2/§2.3/§2.5).

Structs§

Clock
A monotonic nanosecond clock shared across a task’s processors. Mirrors pipecat’s pipeline Clock (task.py): one Instant base captured at setup, now_ns() returns elapsed-since-base in ns.
Envelope
The frame envelope that travels a processor’s input channel (PROCESSOR-DESIGN §2.1). Carries the FrameMeta out of band so the hot Frame variant stays a thin pointer move.
Link
A processor’s view of “downstream” / “upstream” — a sender to each neighbour, wired by crate::pipeline::Pipeline. Cloned into the processor’s run loop.
ProcessorSetup
One-time per-task wiring handed to every processor at startup (mirrors pipecat FrameProcessorSetup, frame_processor.py:71): the pipeline clock, the (optional) observer fan-out, the shared cancellation token, and the metric toggles.

Enums§

StopReason
Why a processor’s FrameProcessor::stop was called.
Topology
The wiring shape a processor expands to when a crate::pipeline::Pipeline links its members (PROCESSOR-DESIGN §3). A leaf is one spawned task; a Chain is wired head→tail in order; a Parallel fans one input into every branch and funnels/dedups the outputs. This is how Pipeline/ParallelPipeline nest without a downcast.

Traits§

FrameProcessor
The building block (PROCESSOR-DESIGN §2.1). Each processor runs in its own tokio task fed by a bounded mpsc channel; the framework owns the task loop, an impl writes only process_frame (and optional start/stop).

Functions§

into_topology
Convert a boxed processor into a wiring Topology: a composite explodes into its internal graph; a leaf becomes Topology::Leaf. The single entry point the pipeline linker uses (object-safe, no Sized coercion in a default body).