classy_discovery_strategy ¶This module defines a behavior of discovery strategy.
-callback unregister(options()) -> ok |
ignore |
{error, term()}.
-callback register(options()) -> ok |
ignore |
{error, term()}.
-callback unlock(options()) -> ok |
ignore |
{error, term()}.
-callback lock(options()) -> ok |
ignore |
{error, term()}.
-callback discover(options()) -> {ok, [node()]} |
{error, term()}.
-spec get() -> t() | undefined.
Read discovery_strategy environment variable and decide which strategy to use.
-spec hook(fun(({atom(), options()}) -> {ok, module()} |
undefined),
classy_hook:prio()) -> classy_hook:hook().
Register a discovery strategy.
Callbacks registered here match on the discovery_strategy configuration
and return callback module implementing classy_discovery_strategy behavior.
The first hook that returns {ok, Module} wins
and handles all the callbacks for the next discovery cycle.