View Source Wayfarer.Target.Selector (wayfarer v0.6.1)
Given a list of targets and an algorithm decide which target the request should be forwarded to.
Summary
Types
The algorithm used to select which target to forward requests to (when there is more than one matching target).
Functions
Tries to choose a target from the list of targets to send the request to based on the chosen algorithm.
A guard for testing if an algorithm is supported.
Types
@type algorithm() :: :least_connections | :random | :round_robin | :sticky
The algorithm used to select which target to forward requests to (when there is more than one matching target).
Functions
@spec choose(Plug.Conn.t(), [Wayfarer.Router.target()], Wayfarer.Router.algorithm()) :: {:ok, Wayfarer.Router.target()} | :error
Tries to choose a target from the list of targets to send the request to based on the chosen algorithm.
@spec is_algorithm(any()) :: Macro.output()
A guard for testing if an algorithm is supported.