%%%------------------------------------------------------------------- %%% @author Fernando Benavides %%% @author Chad DePue %%% @copyright (C) 2011 InakaLabs SRL %%% @doc Edis client manager %%% @end %%%------------------------------------------------------------------- -module(edis_client_mgr). -author('Fernando Benavides '). -author('Chad DePue '). -behaviour(supervisor). -export([start_link/1, start_client/0, init/1]). %% ==================================================================== %% External functions %% ==================================================================== %% @doc Starts the supervisor process -spec start_link(atom()) -> ignore | {error, term()} | {ok, pid()}. start_link(Opts=#{name := Name}) -> supervisor:start_link({local, Name}, ?MODULE, Opts). %% @doc Starts a new client process -spec start_client() -> {ok, pid() | undefined} | {error, term()}. start_client() -> supervisor:start_child(?MODULE, []). %% ==================================================================== %% Server functions %% ==================================================================== %% @hidden -spec init(map()) -> {ok, {{simple_one_for_one, 100, 1}, [supervisor:child_spec()]}}. init(Opts) -> {ok, {{simple_one_for_one, 100, 1}, [{edis_client, {edis_client, start_link, [Opts]}, temporary, brutal_kill, worker, [edis_client]}]}}.