%%------------------------------------------------------------------- %% Copyright (c) 2020 Vasu Dasari vdasari@gmail.com %% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. %% You may obtain a copy of the License at: %% %% http://www.apache.org/licenses/LICENSE-2.0 %% %% Unless required by applicable law or agreed to in writing, software %% distributed under the License is distributed on an "AS IS" BASIS, %% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. %% See the License for the specific language governing permissions and %% limitations under the License. %% %% @author Vasu Dasari %% @doc ovsdb top level supervisor. %% @private %% @end %%%------------------------------------------------------------------- -module(ovsdb_sup). -behaviour(supervisor). -export([start_link/0]). -export([init/1]). -define(SERVER, ?MODULE). -define(Process(Name, Type), {Name, {Name, start_link, []}, permanent, 2000, Type, [Name]}). -define(Process(Name, Type, Args), {Name, {Name, start_link, [Args]}, permanent, 2000, Type, [Name]}). start_link() -> supervisor:start_link({local, ?SERVER}, ?MODULE, []). %% sup_flags() = #{strategy => strategy(), % optional %% intensity => non_neg_integer(), % optional %% period => pos_integer()} % optional %% child_spec() = #{id => child_id(), % mandatory %% start => mfargs(), % mandatory %% restart => restart(), % optional %% shutdown => shutdown(), % optional %% type => worker(), % optional %% modules => modules()} % optional init([]) -> RestartStrategy = one_for_one, MaxRestarts = 3, MaxSecondsBetweenRestarts = 5, SupFlags = {RestartStrategy, MaxRestarts, MaxSecondsBetweenRestarts}, _Restart = permanent, _Shutdown = 2000, _Type = worker, ProcessList = [ ?Process(ovsdb_client,worker) ], {ok, {SupFlags,ProcessList}}. %% internal functions