ekfa/apps/efka/src/efka_sup.erl
2025-09-16 18:52:12 +08:00

91 lines
2.6 KiB
Erlang

%%%-------------------------------------------------------------------
%% @doc efka top level supervisor.
%% @end
%%%-------------------------------------------------------------------
-module(efka_sup).
-behaviour(supervisor).
-export([start_link/0]).
-export([init/1]).
-define(SERVER, ?MODULE).
start_link() ->
supervisor:start_link({local, ?SERVER}, ?MODULE, []).
%% sup_flags() = #{strategy => strategy(), % optional
%% intensity => non_neg_integer(), % optional
%% period => pos_integer()} % optional
%% child_spec() = #{id => child_id(), % mandatory
%% start => mfargs(), % mandatory
%% restart => restart(), % optional
%% shutdown => shutdown(), % optional
%% type => worker(), % optional
%% modules => modules()} % optional
init([]) ->
SupFlags = #{strategy => one_for_one, intensity => 1000, period => 3600},
ChildSpecs = [
#{
id => 'efka_docker_events',
start => {'efka_docker_events', start_link, []},
restart => permanent,
shutdown => 2000,
type => worker,
modules => ['efka_docker_events']
},
#{
id => 'efka_model_sup',
start => {'efka_model_sup', start_link, []},
restart => permanent,
shutdown => 2000,
type => supervisor,
modules => ['efka_model_sup']
},
#{
id => 'efka_inetd_task_log',
start => {'efka_inetd_task_log', start_link, []},
restart => permanent,
shutdown => 2000,
type => worker,
modules => ['efka_inetd_task_log']
},
#{
id => 'efka_subscription',
start => {'efka_subscription', start_link, []},
restart => permanent,
shutdown => 2000,
type => worker,
modules => ['efka_subscription']
},
#{
id => 'efka_inetd',
start => {'efka_inetd', start_link, []},
restart => permanent,
shutdown => 2000,
type => worker,
modules => ['efka_inetd']
}
%#{
% id => 'efka_remote_agent',
% start => {'efka_remote_agent', start_link, []},
% restart => permanent,
% shutdown => 2000,
% type => worker,
% modules => ['efka_remote_agent']
%},
],
{ok, {SupFlags, ChildSpecs}}.
%% internal functions