View Source brod_supervisor3 behaviour (brod v3.17.0)
Link to this section Summary
Types
XXX: refine
Link to this section Types
-type call() :: which_children | count_children | {_, _}.
-type child() :: undefined | pid().
-type child_id() :: term().
-type child_rec() :: #child{}.
-type delay() :: non_neg_integer().
-type init_sup_name() :: sup_name() | self.
-type mfargs() :: {M :: module(), F :: atom(), A :: [term()] | undefined}.
-type modules() :: [module()] | dynamic.
-type shutdown() :: brutal_kill | timeout().
-type startchild_err() :: already_present | {already_started, Child :: child()} | term().
-type startchild_ret() :: {ok, Child :: child()} | {ok, Child :: child(), Info :: term()} | {error, startchild_err()}.
-type startlink_err() :: {already_started, pid()} | {shutdown, term()} | term().
-type startlink_ret() :: {ok, pid()} | ignore | {error, startlink_err()}.
-type state() :: #state{name :: atom(), strategy :: strategy(), children :: [child_rec()], dynamics :: dynamics(), intensity :: non_neg_integer(), period :: pos_integer(), restarts :: list(), module :: module(), args :: list()}.
-type stop_rsn() ::
{shutdown, term()} |
{bad_return, {module(), init, term()}} |
{bad_start_spec, term()} |
{start_spec, term()} |
{supervisor_data, term()}.
-type strategy() :: one_for_all | one_for_one | rest_for_one | simple_one_for_one.
-type sup_name() :: {local, Name :: atom()} | {global, Name :: atom()}.
-type sup_ref() ::
(Name :: atom()) | {Name :: atom(), Node :: node()} | {global, Name :: atom()} | pid().
-type tref() :: reference().
-type worker() :: worker | supervisor.
Link to this section Callbacks
-callback init(Args :: term()) -> {ok, {{RestartStrategy :: strategy(), MaxR :: non_neg_integer(), MaxT :: non_neg_integer()}, [ChildSpec :: child_spec()]}} | ignore | post_init.
-callback post_init(Args :: term()) -> {ok, {{RestartStrategy :: strategy(), MaxR :: non_neg_integer(), MaxT :: non_neg_integer()}, [ChildSpec :: child_spec()]}} | ignore.
Link to this section Functions
-spec check_childspecs(ChildSpecs) -> Result when ChildSpecs :: [child_spec()], Result :: ok | {error, Error :: term()}.
-spec count_children(SupRef) -> PropListOfCounts when SupRef :: sup_ref(), PropListOfCounts :: [Count], Count :: {specs, ChildSpecCount :: non_neg_integer()} | {active, ActiveProcessCount :: non_neg_integer()} | {supervisors, ChildSupervisorCount :: non_neg_integer()} | {workers, ChildWorkerCount :: non_neg_integer()}.
-spec init({init_sup_name(), module(), [term()]}) -> {ok, state()} | ignore | {stop, stop_rsn()}.
-spec start_child(SupRef, ChildSpec) -> startchild_ret() when SupRef :: sup_ref(), ChildSpec :: child_spec() | (List :: [term()]).
-spec start_link(Module, Args) -> startlink_ret() when Module :: module(), Args :: term().
-spec start_link(SupName, Module, Args) -> startlink_ret() when SupName :: sup_name(), Module :: module(), Args :: term().
-spec terminate(term(), state()) -> ok.