47 lines
1.3 KiB
Erlang
47 lines
1.3 KiB
Erlang
%%% @doc
|
|
%%% GajuDesk Top-level Supervisor
|
|
%%%
|
|
%%% The very top level supervisor in the system. It only has one service branch: the
|
|
%%% "con" (program controller). The con is the
|
|
%%% only be one part of a larger system. Were this a game system, for example, the
|
|
%%% item data management service would be a peer, as would a login credential provision
|
|
%%% service, game world event handling, and so on.
|
|
%%%
|
|
%%% See: http://erlang.org/doc/design_principles/applications.html
|
|
%%% See: http://zxq9.com/archives/1311
|
|
%%% @end
|
|
|
|
-module(gd_sup).
|
|
-vsn("0.5.5").
|
|
-behaviour(supervisor).
|
|
-author("Craig Everett <craigeverett@qpq.swiss>").
|
|
-copyright("QPQ AG <info@qpq.swiss>").
|
|
-license("GPL-3.0-or-later").
|
|
|
|
-export([start_link/0]).
|
|
-export([init/1]).
|
|
|
|
|
|
-spec start_link() -> {ok, pid()}.
|
|
%% @private
|
|
%% This supervisor's own start function.
|
|
|
|
start_link() ->
|
|
supervisor:start_link({local, ?MODULE}, ?MODULE, []).
|
|
|
|
|
|
-spec init([]) -> {ok, {supervisor:sup_flags(), [supervisor:child_spec()]}}.
|
|
%% @private
|
|
%% The OTP init/1 function.
|
|
|
|
init([]) ->
|
|
RestartStrategy = {one_for_one, 0, 60},
|
|
Controller = {gd_con,
|
|
{gd_con, start_link, []},
|
|
permanent,
|
|
5000,
|
|
worker,
|
|
[gd_con]},
|
|
Children = [Controller],
|
|
{ok, {RestartStrategy, Children}}.
|