Stopsel behaviour (stopsel v0.1.0) View Source
A stopsel accepts a message (Stopsel.Message), modifies it or
prevents it from being passed further down the pipeline.
Similar to the library Plug, a stopsel can be either a function or a
module that implements the Stopsel behaviour.
Module Stopsel
A module stopsel must implement the callbacks init/1 and call/2
init/1
Accepts a configuration and passes it as second parameter to call/2.
Use this callback to prepare the configuration and if necessary evaluate
its correctness.
Currently the configuration is evaluated at runtime. This is subject to change in future versions.
call/2
Accepts a message and the evaluated configuration from init/1.
Use this callback to edit the parameters and assigns of the message
or halt the message if necessary. Must return a Stopsel.Message
Function stopsel
A function stopsel will receive a message and a configuration, without preprocessing the configuration. Currently a function stopsel must be declared as atom that corresponds to an imported function. This is subject to change in future versions.
Use this function to edit the parameters and assigns or halt the message if necessary.
Must return a Stopsel.Message
Link to this section Summary
Link to this section Types
Link to this section Callbacks
Specs
call(Stopsel.Message.t(), config()) :: Stopsel.Message.t()