1 |
|
%%% Textgroup server. |
2 |
|
%%% |
3 |
|
%%% Copyright (c) 2022 Holger Weiss <holger@zedat.fu-berlin.de>. |
4 |
|
%%% All rights reserved. |
5 |
|
%%% |
6 |
|
%%% Licensed under the Apache License, Version 2.0 (the "License"); |
7 |
|
%%% you may not use this file except in compliance with the License. |
8 |
|
%%% You may obtain a copy of the License at |
9 |
|
%%% |
10 |
|
%%% http://www.apache.org/licenses/LICENSE-2.0 |
11 |
|
%%% |
12 |
|
%%% Unless required by applicable law or agreed to in writing, software |
13 |
|
%%% distributed under the License is distributed on an "AS IS" BASIS, |
14 |
|
%%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
15 |
|
%%% See the License for the specific language governing permissions and |
16 |
|
%%% limitations under the License. |
17 |
|
|
18 |
|
-module(textgroup_sup). |
19 |
|
-behaviour(supervisor). |
20 |
|
-export([start_link/0, |
21 |
|
init/1]). |
22 |
|
|
23 |
|
-include_lib("kernel/include/logger.hrl"). |
24 |
|
-define(SERVER, ?MODULE). |
25 |
|
|
26 |
|
-spec start_link() -> {ok, pid()} | {error, term()}. |
27 |
|
start_link() -> |
28 |
1 |
?LOG_DEBUG("Starting Textgroup supervisor"), |
29 |
1 |
supervisor:start_link({local, ?SERVER}, ?MODULE, []). |
30 |
|
|
31 |
|
-spec init([]) -> {ok, {supervisor:sup_flags(), [supervisor:child_spec()]}}. |
32 |
|
init([]) -> |
33 |
1 |
?LOG_DEBUG("Initializing Textgroup supervisor"), |
34 |
1 |
SupFlags = #{}, |
35 |
1 |
ChildSpecs = [#{id => textgroup_acceptor_sup, |
36 |
|
type => supervisor, |
37 |
|
start => {textgroup_acceptor_sup, start_link, []}}, |
38 |
|
#{id => textgroup_client_sup, |
39 |
|
type => supervisor, |
40 |
|
start => {textgroup_client_sup, start_link, []}}, |
41 |
|
#{id => systemd, |
42 |
|
type => worker, |
43 |
|
start => {textgroup_systemd, start_link, []}}], |
44 |
1 |
{ok, {SupFlags, ChildSpecs}}. |