summaryrefslogtreecommitdiff
path: root/src/mem3_sup.erl
blob: 58d0bbf51ca2a5c70ffd67a373c846febe1cfe4b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
-module(mem3_sup).
-behaviour(supervisor).
-export([start_link/0, init/1]).

start_link() ->
    supervisor:start_link({local, ?MODULE}, ?MODULE, []).

init(_Args) ->
    Children = [
        child(mem3_events),
        child(mem3_sync),
        child(mem3_cache),
        child(mem3_nodes)
    ],
    {ok, {{one_for_one,10,1}, Children}}.

child(mem3_events) ->
    MFA = {gen_event, start_link, [{local, mem3_events}]},
    {mem3_events, MFA, permanent, 1000, worker, dynamic};
child(Child) ->
    {Child, {Child, start_link, []}, permanent, 1000, worker, [Child]}.