partisan_peer_discovery_agent behaviour (partisan v5.0.1)

View Source

This state machine is responsible for enabled cluster peers using the defined implementation backend (callback module).

Summary

Types

state/0

-type state() ::
          #state{enabled :: boolean(),
                 callback_mod :: module() | undefined,
                 callback_config :: map() | undefined,
                 callback_state :: any() | undefined,
                 initial_delay :: integer() | undefined,
                 polling_interval :: integer() | undefined,
                 timeout :: integer() | undefined,
                 peers :: [partisan:node_spec()]}.

Callbacks

init/1

-callback init(Opts :: map()) -> {ok, State :: any()} | {error, Reason :: any()}.

lookup/2

-callback lookup(State :: any(), Timeout :: timeout()) ->
                    {ok, [partisan:node_spec()], NewState :: any()} |
                    {error, Reason :: any(), NewState :: any()}.

Functions

callback_mode()

code_change(OldVsn, StateName, State, Extra)

disable()

-spec disable() -> ok.

disabled(EventType, EventContent, State)

enable()

-spec enable() -> ok.

enabled(EventType, EventContent, State)

In this state the agent uses the callback module to discover peers by calling its lookup/2 callback.

init(_)

lookup()

start()

-spec start() -> {ok, pid()} | ignore | {error, term()}.

start_link()

-spec start_link() -> {ok, pid()} | ignore | {error, term()}.

status()

-spec status() -> enabled | disabled.

terminate(Reason, StateName, State)