Commit | Line | Data |
---|---|---|
caf75ed8 SK |
1 | -module(beam_stats_sup). |
2 | ||
3 | -behaviour(supervisor). | |
4 | ||
5 | %% API | |
b2c364fd | 6 | -export([start_link/1]). |
caf75ed8 SK |
7 | |
8 | %% Supervisor callbacks | |
9 | -export([init/1]). | |
10 | ||
11 | %% Helper macro for declaring children of supervisor | |
b2c364fd SK |
12 | -define(CHILD(Type, Module, Args), |
13 | {Module, {Module, start_link, Args}, permanent, 5000, Type, [Module]}). | |
caf75ed8 SK |
14 | |
15 | %% =================================================================== | |
16 | %% API functions | |
17 | %% =================================================================== | |
18 | ||
b2c364fd SK |
19 | start_link(DeltasServer) -> |
20 | supervisor:start_link({local, ?MODULE}, ?MODULE, DeltasServer). | |
caf75ed8 SK |
21 | |
22 | %% =================================================================== | |
23 | %% Supervisor callbacks | |
24 | %% =================================================================== | |
25 | ||
b2c364fd | 26 | init(DeltasServer) -> |
caf75ed8 | 27 | Children = |
b2c364fd SK |
28 | [ ?CHILD(worker , beam_stats_producer , [DeltasServer]) |
29 | , ?CHILD(supervisor , beam_stats_sup_consumers, []) | |
30 | ], | |
caf75ed8 SK |
31 | SupFlags = {one_for_one, 5, 10}, |
32 | {ok, {SupFlags, Children}}. |