4.3 Module classy_discovery_strategy

This module defines a behavior of discovery strategy.

4.3.1 Callbacks

unregister/1
-callback unregister(options()) -> ok |
                                   ignore |
                                   {error, term()}.
register/1
-callback register(options()) -> ok |
                                 ignore |
                                 {error, term()}.
unlock/1
-callback unlock(options()) -> ok |
                               ignore |
                               {error, term()}.
lock/1
-callback lock(options()) -> ok |
                             ignore |
                             {error, term()}.
discover/1
-callback discover(options()) -> {ok, [node()]} |
                                 {error, term()}.

4.3.2 Types

options()
-type options() :: term().
t()
-type t() :: {module(), options()}.

4.3.3 Functions

get()
-spec get() -> t() | undefined.

Read discovery_strategy environment variable and decide which strategy to use.

hook(Fun, Prio)
-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.


JavaScript license information