Current section
Files
Jump to
Current section
Files
src/elector_sup.erl
%%%-------------------------------------------------------------------
%% @doc elector top level supervisor.
%% @end
%%%-------------------------------------------------------------------
-module(elector_sup).
%%--------------------------------------------------------------------
%% Behaviours
%%--------------------------------------------------------------------
-behaviour(supervisor).
%%--------------------------------------------------------------------
%% Exported API
%%--------------------------------------------------------------------
-export([start_link/0]).
-export([init/1]).
%%--------------------------------------------------------------------
%% Definitions
%%--------------------------------------------------------------------
-define(SERVER, ?MODULE).
%%--------------------------------------------------------------------
%% Exported functions
%%--------------------------------------------------------------------
%% @doc Starts the supervisor process.
start_link() ->
supervisor:start_link({local, ?SERVER}, ?MODULE, []).
%%--------------------------------------------------------------------
%% Callback functions
%%--------------------------------------------------------------------
init([]) ->
ElectionWorker = #{id => election_worker, start => {election_worker, start_link, []}},
SupFlags =
#{strategy => one_for_all,
intensity => 0,
period => 1},
ChildSpecs = [ElectionWorker],
{ok, {SupFlags, ChildSpecs}}.