erlang自动编译与加载
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

27 řádky
1014 B

před 5 roky
před 5 roky
před 5 roky
  1. -module(eSync_sup).
  2. -behaviour(supervisor).
  3. -export([
  4. start_link/0
  5. , init/1
  6. ]).
  7. -define(SERVER, ?MODULE).
  8. -define(ChildSpec(I, Type), #{id => I, start => {I, start_link, []}, restart => permanent, shutdown => 5000, type => Type, modules => [I]}).
  9. start_link() ->
  10. supervisor:start_link({local, ?SERVER}, ?MODULE, []).
  11. %% sup_flags() = #{strategy => strategy(), % optional
  12. %% intensity => non_neg_integer(), % optional
  13. %% period => pos_integer()} % optional
  14. %% child_spec() = #{id => child_id(), % mandatory
  15. %% start => mfargs(), % mandatory
  16. %% restart => restart(), % optional
  17. %% shutdown => shutdown(), % optional
  18. %% type => worker(), % optional
  19. %% modules => modules()} % optional
  20. init([]) ->
  21. SupFlags = #{strategy => one_for_one, intensity => 5, period => 10},
  22. ChildSpecs = [?ChildSpec(esSyncSrv, worker)],
  23. {ok, {SupFlags, ChildSpecs}}.