-
Notifications
You must be signed in to change notification settings - Fork 5
/
htoad_sup.erl
44 lines (34 loc) · 1.22 KB
/
htoad_sup.erl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
-module(htoad_sup).
-behaviour(esupervisor).
-include_lib("esupervisor/include/esupervisor.hrl").
-include_lib("htoad/include/htoad.hrl").
%% API
-export([start_link/1, start_seresye/0]).
%% Supervisor callbacks
-export([init/1]).
%% ===================================================================
%% API functions
%% ===================================================================
start_link(Args) ->
esupervisor:start_link({local, ?MODULE}, ?MODULE, [Args]).
start_seresye() ->
{ok, Pid} = htoad_engine:start(?ENGINE),
htoad_engine:set_hooks(?ENGINE,[{before_rule, fun htoad_trace:rule/3}]),
{ok, Pid}.
%% ===================================================================
%% Supervisor callbacks
%% ===================================================================
init([_Args]) ->
#one_for_one{
children = [
#worker{
id = ?ENGINE,
restart = permanent,
start_func = {htoad_sup, start_seresye, []}
},
#one_for_one {
id = htoad_toadies,
registered = htoad_toadies
}
]
}.