Module chain

Module chain 

Source
Expand description

The unified plugin dispatch chain (DW-119).

PluginChain is the single integration seam the dataplane calls. Given a route’s plugin names, the gateway’s plugin configs, the native registry, and an optional WASM dispatch adapter, it builds the per-request execution list combining native filters and WASM instances IN PHASE ORDER (deterministic, using the same ordering logic as wasm::lifecycle::PluginLifecycle::phase_order). It exposes the same phase methods as the WASM runner (on_request_headers, on_request_body, on_response_headers, on_response_body) and dispatches to each plugin in order, threading headers/body through and short-circuiting on LocalResponse/Error.

§Why a generic WasmDispatch adapter

plugins must not depend on wasm (that would be an upward import once wasm depends on plugins for the adapter). Instead, the chain is generic over a WasmDispatch trait – a minimal per-request interface the wasm domain implements to bridge its PluginInstances into the unified chain. The proxy-wasm host always compiles (DW-157); NoWasm serves native-only chains and tests.

§Attachment semantics equivalence

A native filter and a WASM plugin occupy the same phase slot on the same route, selected by config. The chain orders them by their position in the route’s plugins list within each phase (the same deterministic order phase_order produces), so there is no dataplane-visible difference in attachment semantics – only the implementation differs (compiled-in vs sandboxed).

Structs§

NativeCreateFailure
A native filter whose factory errored while the chain was being built (DW-157). The configured filter could not be constructed, so it NEVER runs; the chain reports the failure instead of silently skipping the entry, and the caller must fail closed (a request the gate admitted must not proceed without a plugin its route configures).
NoWasm
A no-op WASM dispatch adapter for native-only chains (and tests). Every method returns ChainOutcome::Continue with the input unchanged.
PluginChain
The unified per-request plugin chain.

Enums§

ChainOutcome
The per-request outcome of a unified chain phase, mirroring wasm::runner::PhaseOutcome so the dataplane treats native and WASM plugins identically.

Traits§

WasmDispatch
A minimal per-request WASM dispatch interface the wasm domain implements to bridge its PluginInstances into the unified chain.