summaryrefslogtreecommitdiff
path: root/src/plop_sup.erl
blob: eb6592554110150efda01f55968a291fd027042f (plain)
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
45
46
47
48
49
50
%%% Copyright (c) 2014, NORDUnet A/S.
%%% See LICENSE for licensing information.

-module(plop_sup).
-behaviour(supervisor).

-export([start_link/1, init/1]).
-export([start_in_shell/1]).

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

%% For testing.
start_in_shell(Args) ->
    {ok, Pid} = start_link(Args),
    unlink(Pid).

%% Supervisor callback
init(Args) ->
    {ok, {{one_for_one, 3, 10},
          [{the_db,
            {db, start_link, []},
            permanent,
            10000,
            worker, [db]},
           {the_storagedb,
            {storagedb, start_link, []},
            permanent,
            10000,
            worker, [storagedb]},
           {fsync,
            {fsyncport, start_link, []},
            permanent,
            10000,
            worker, [fsyncport]},
           {the_ht,
            {ht, start_link, []},
            permanent,
            10000,
            worker, [ht]},
           {the_signing,
            {sign, start_link, Args},          % All arguments go to sign.
            permanent,
            10000,
            worker, [sign]},
           {the_plop,
            {plop, start_link, []},
            permanent,
            10000,                             % Shut down within 10s.
            worker, [plop]}]}}.