Module:start(StartType,StartArgs)->{ok,Pid}|{ok,Pid,State}|{error,Reason}
Types:
StartType = start_type()
StartArgs = term()
Pid = pid()
State = term()
This function is called whenever an application is started using start/1,2, and is to start the
processes of the application. If the application is structured according to the OTP design
principles as a supervision tree, this means starting the top supervisor of the tree.
StartType defines the type of start:
* normal if it is a normal startup.
* normal also if the application is distributed and started at the current node because of a
failover from another node, and the application specification key start_phases==undefined.
* {takeover,Node} if the application is distributed and started at the current node because of a
takeover from Node, either because takeover/2 has been called or because the current node has
higher priority than Node.
* {failover,Node} if the application is distributed and started at the current node because of a
failover from Node, and the application specification key start_phases/=undefined.
StartArgs is the StartArgs argument defined by the application specification key mod.
The function is to return {ok,Pid} or {ok,Pid,State}, where Pid is the pid of the top supervisor
and State is any term. If omitted, State defaults to []. If the application is stopped later,
State is passed to Module:prep_stop/1.
Module:start_phase(Phase,StartType,PhaseArgs)->ok|{error,Reason}
Types:
Phase = atom()
StartType = start_type()
PhaseArgs = term()
Pid = pid()
State = state()
Starts an application with included applications, when synchronization is needed between processes
in the different applications during startup.
The start phases are defined by the application specification key start_phases==[{Phase,PhaseArgs}]. For included applications, the set of phases must be a subset of the set of
phases defined for the including application.
The function is called for each start phase (as defined for the primary application) for the
primary application and all included applications, for which the start phase is defined.
For a description of StartType, see Module:start/2.
Module:prep_stop(State)->NewState
Types:
State = NewState = term()
This function is called when an application is about to be stopped, before shutting down the
processes of the application.
State is the state returned from Module:start/2, or [] if no state was returned. NewState is any
term and is passed to Module:stop/1.
The function is optional. If it is not defined, the processes are terminated and then
Module:stop(State) is called.
Module:stop(State)
Types:
State = term()
This function is called whenever an application has stopped. It is intended to be the opposite of
Module:start/2 and is to do any necessary cleaning up. The return value is ignored.
State is the return value of Module:prep_stop/1, if such a function exists. Otherwise State is
taken from the return value of Module:start/2.
Module:config_change(Changed,New,Removed)->ok
Types:
Changed = [{Par,Val}]
New = [{Par,Val}]
Removed = [Par]
Par = atom()
Val = term()
This function is called by an application after a code replacement, if the configuration
parameters have changed.
Changed is a list of parameter-value tuples including all configuration parameters with changed
values.
New is a list of parameter-value tuples including all added configuration parameters.
Removed is a list of all removed parameters.