View Source brod_supervisor3 behaviour (brod v4.1.0)
Summary
Types
XXX: refine
Types
-type call() :: which_children | count_children | {_, _}.
-type child() :: undefined | pid().
-type child_id() :: term().
-type delay() :: non_neg_integer().
-type init_sup_name() :: sup_name() | self.
-type modules() :: [module()] | dynamic.
-type shutdown() :: brutal_kill | timeout().
-type startchild_ret() :: {ok, Child :: child()} | {ok, Child :: child(), Info :: term()} | {error, startchild_err()}.
-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 strategy() :: one_for_all | one_for_one | rest_for_one | simple_one_for_one.
-type tref() :: reference().
-type worker() :: worker | supervisor.
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.
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().