pub struct FlowCtx {
pub span: Span,
pub log: Arc<dyn FlowLogSink>,
pub cancel: CancellationToken,
pub accept_cancel: CancellationToken,
pub verbosity: FlowLogVerbosity,
pub trajectory: TrajectoryBuilder,
}Expand description
Per-walk execution context. Constructed once per L4 connection (and
re-constructed per L7 request when a hyper service-fn dispatches into
the L7 sub-graph). Fields are owned — no lifetime parameter — so the
struct survives tokio::spawn and move closures (notably hyper’s
service-fn closure at Node::Upgrade, which captures log / cancel
/ verbosity per request).
Arc<dyn FlowLogSink> and CancellationToken clone cheaply (each is
internally an Arc), and tracing::Span is also Arc-backed; the
per-request clones in the hyper bridge are O(1).
Fields§
§span: Span§log: Arc<dyn FlowLogSink>§cancel: CancellationTokenHard-cancel token. Fired by the listener’s force_cancel tier
when shutdown’s soft-drain window expires. Long-lived
terminators (ByteTunnel, UDP tunnel) select! on this and
surface CloseReason::Cancelled. Per-request hyper drivers
hand this to their per-request executor wiring.
accept_cancel: CancellationTokenSoft-drain token. Fired by the listener’s accept_cancel tier
at the start of shutdown / listener removal — well before
cancel (force_cancel) trips. Hyper H1 / H2 drivers wire
this into graceful_shutdown() so idle keep-alive clients see
Connection: close (H1) or GOAWAY (H2) immediately rather
than camping until the drain budget runs out. Defaults to a
fresh detached CancellationToken so call sites that have not
been wired through yet keep their pre-split semantics.
verbosity: FlowLogVerbosityVerbosity selected when this connection was accepted. The listener
reads engine::VerbosityState once at FlowCtx construction;
in-flight connections retain the value they were built with.
trajectory: TrajectoryBuilderWalker-internal step accumulator. The executor pushes one entry
per node-visit and emits a single FlowLogKind::Trajectory event
from finalize() at terminate or error.