Minimal Plug-style pipeline executor for Spectre router stages.
Router pipelines collect evidence rather than immediately executing handlers. This shape lets each plug focus on one strategy (regex, cache, classifier, embedding, arbitration) while the final route decision remains explicit.
defmodule MyApp.RouterPipeline do
use Spectre.Pipeline
pipeline do
plug Spectre.Router.Plugs.Regex
plug Spectre.Router.Plugs.LocalClassifier
plug Spectre.Router.Plugs.Arbitrate
plug Spectre.Router.Plugs.Terminalize
end
end
Summary
Functions
Imports router pipeline macros into a custom pipeline module.
Initializes pipeline specs.
Initializes pipeline specs and raises on invalid declarations.
Groups router plug declarations.
Adds a router plug declaration to a custom pipeline.
Runs a router context through initialized or ad-hoc plug specs.
Types
@type plug_spec() :: module() | {module(), keyword()} | Spectre.Pipeline.Spec.t()
Functions
Imports router pipeline macros into a custom pipeline module.
@spec init_specs([plug_spec()]) :: {:ok, [Spectre.Pipeline.Spec.t()]} | {:error, term()}
Initializes pipeline specs.
@spec init_specs!([plug_spec()]) :: [Spectre.Pipeline.Spec.t()]
Initializes pipeline specs and raises on invalid declarations.
Groups router plug declarations.
Adds a router plug declaration to a custom pipeline.
plug Spectre.Router.Plugs.Regex
plug Spectre.Router.Plugs.LocalClassifier, classifier_local: MyApp.Classifier
@spec run(Spectre.Router.Context.t(), [plug_spec()]) :: {:ok, Spectre.Router.Context.t()} | {:error, term()}
Runs a router context through initialized or ad-hoc plug specs.