restructure to be a littel more flexible
[lwes-erlang/github-mirror.git] / src / lwes_sup.erl
bloba2dcbead4535fa0aaa2d794997c2252b2673697e
1 -module (lwes_sup).
3 -behaviour (supervisor).
5 %% API
6 -export([start_link/0]).
8 %% supervisor callbacks
9 -export([init/1]).
11 %-=====================================================================-
12 %- API -
13 %-=====================================================================-
14 start_link() ->
15 supervisor:start_link({local, ?MODULE}, ?MODULE, []).
17 %-=====================================================================-
18 %- supervisor callbacks -
19 %-=====================================================================-
20 init([]) ->
21 { ok,
23 { one_for_one, 10, 10 },
25 { lwes_stats,
26 { lwes_stats, start_link, [] },
27 permanent,
28 2000,
29 worker,
30 [ lwes_stats ]
32 { lwes_emitter_udp_pool,
33 { lwes_emitter_udp_pool, start_link, [[{id, lwes_emitters}]] },
34 permanent,
35 2000,
36 worker,
37 [ lwes_emitter_udp_pool ]
39 { lwes_channel_manager, % child spec id
40 { lwes_channel_manager, start_link, [] },% child function to call
41 permanent, % always restart
42 2000, % time to wait for child stop
43 worker, % type of child
44 [ lwes_channel_manager ] % modules used by child
47 lwes_channel_sup, % child spec id
48 { lwes_channel_sup, start_link, []}, % child function to call
49 permanent, % always restart
50 2000, % time to wait for child stop
51 supervisor, % type of child
52 [ lwes_channel_sup ] % modules used by child
54 { lwes_esf_validator, % child spec id
55 { lwes_esf_validator, start_link, [] }, % child function to call
56 permanent, % always restart
57 2000, % time to wait for child stop
58 worker, % type of child
59 [ lwes_esf_validator ] % modules used by child
65 %-=====================================================================-
66 %- Private -
67 %-=====================================================================-
70 %-=====================================================================-
71 %- Test Functions -
72 %-=====================================================================-
73 -ifdef (TEST).
74 -include_lib ("eunit/include/eunit.hrl").
76 lwes_sup_test_ () ->
77 { setup,
78 fun () ->
79 {ok, Pid} = start_link(),
80 Pid
81 end,
82 fun (Pid) ->
83 exit (Pid, normal)
84 end,
86 inorder,
88 ?_assertEqual (true, true)
93 -endif.