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

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

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

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