%%%------------------------------------------------------------------- %% @doc erlk top level supervisor. %% @end %%%------------------------------------------------------------------- -module(erlk_sup). -behaviour(supervisor). -export([start_link/1]). -export([init/1]). start_link(DBPath) -> supervisor:start_link(?MODULE, [DBPath]). %% 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(DBPath) -> SupFlags = #{strategy => rest_for_one}, ChildSpecs = [ #{id => schedule, start => {schedule, start_link, []} }, #{id => database, start => {database, start_link, [DBPath]} }, #{id => mqtt, start => {mqtt, start_link, []} }, #{id => event_mgr, start => {event_mgr, start_link, [[mqtt]]} } ], {ok, {SupFlags, ChildSpecs}}. %% internal functions