Skip to main content

PLUGIN_API_VERSION_V3

Constant PLUGIN_API_VERSION_V3 

Source
pub const PLUGIN_API_VERSION_V3: u32 = 3;
Expand description

API version v3: adds drain so the hub can wait for a plugin’s fire-and-forget background work (mirror’s runtime.spawn’d HTTP dispatches, otel’s batched exporter queue, etc.) to quiesce before shutdown is invoked on a reload. Plugins that complete all work inside process() (coraza, external-auth, sso-auth, …) get the define_plugin! macro’s default thunk which returns immediately — no in-flight state, nothing to wait for. Plugins with background work override drain to block until their state is quiescent or the supplied deadline elapses.

Compat: v3 plugins keep loading on v2/v1 hubs (those hubs ignore the new field); v2/v1 plugins keep loading on v3 hubs (the hub gates access on api_version >= 3 and skips the drain wait for older plugins — equivalent to today’s behaviour, which is the right default since those plugins are all synchronous-only).