Current section

Files

Jump to
diint_utilites_common_app src utilites kv_storage_sup.erl
Raw

src/utilites/kv_storage_sup.erl

%%%-------------------------------------------------------------------
%%% @author cheese
%%% @copyright (C) 2015, <COMPANY>
%%% @doc
%%%
%%% @end
%%% Created : 23. Nov 2015 11:31
%%%-------------------------------------------------------------------
-module(kv_storage_sup).
-author("cheese").
-behaviour(supervisor).
%% API
-export([start_link/2]).
%% Supervisor callbacks
-export([init/1]).
%%%===================================================================
%%% API functions
%%%===================================================================
start_link(LifeTimeSeconds, ServerName) ->
Process = list_to_atom(atom_to_list(ServerName) ++ "_kv_storage_sup"),
supervisor:start_link({local, Process}, ?MODULE, [LifeTimeSeconds, ServerName]).
%%%===================================================================
%%% Supervisor callbacks
%%%===================================================================
init([LifeTimeSeconds, ServerName]) ->
KVStorageName = ServerName,
Storage = {KVStorageName,
{kv_storage, start_link, [LifeTimeSeconds, KVStorageName]},
permanent, 2000, worker,
[]},
{ok, {
{one_for_all, 10, 1},
[Storage]
}
}.
%%%===================================================================
%%% Internal functions
%%%===================================================================