Pinto.Supervisor.SimpleOneForOne
- Package
- erl-pinto
- Repository
- id3as/purescript-erl-pinto
This module represents a simple_one_for_one supervisor in OTP It is a special case because if it has different return values and arguments for pretty much every function See also gen_supervisor in the OTP docs (https://erlang.org/doc/man/supervisor.html#)
#ChildSpec Source
type ChildSpec childStartArg childProcess = { childType :: ChildType, intensity :: Int, period :: Seconds, restartStrategy :: RestartStrategy, shutdownStrategy :: ChildShutdownTimeoutStrategy, start :: childStartArg -> Effect (StartLinkResult childProcess) }
The specification of the dynamic child process, this maps to ChildSpec in the underlying supervisor API
with the difference that none of them are optional
childStartArg
is the parameter expected by the start function for the child. It is provided here
childProcess
is the typed pid of the started process (commonly GenServer.ServerPid)
#SupervisorRef Source
type SupervisorRef childStartArg childProcess = RegistryReference (SupervisorPid childStartArg childProcess) (SupervisorType childStartArg childProcess)
#SupervisorPid Source
newtype SupervisorPid childStartArg childProcess
Instances
HasPid (SupervisorPid childStartArg childProcess)
#SupervisorType Source
newtype SupervisorType childStartArg childProcess
#startLink Source
startLink :: forall childStartArg childProcess. HasPid childProcess => Maybe (RegistryName (SupervisorType childStartArg childProcess)) -> Effect (ChildSpec childStartArg childProcess) -> Effect (StartLinkResult (SupervisorPid childStartArg childProcess))
Start the supervisor, running the provided Effect to get the spec of the children that this OneForOne supervisor can start Returns a pid that can be used to communicate with the supervisor in the startChild call
#startChild Source
startChild :: forall childStartArg childProcess. HasPid childProcess => SupervisorRef childStartArg childProcess -> childStartArg -> Effect (StartChildResult childProcess)
Starts a child within th one_for_one supervisor referred to by SupervisorRef childStartArg childProcess
See also supervisor:start_child in the OTP documentation
#terminateChild Source
terminateChild :: forall childStartArg childProcess. SupervisorRef childStartArg childProcess -> childProcess -> Effect TerminateChildResult
Terminates a child within the one_for_one supervisor referred to by SupervisorRef childStartArg childProcess
See also supervisor:terminate_child in the OTP documentation
#deleteChild Source
deleteChild :: forall childStartArg childProcess. SupervisorRef childStartArg childProcess -> childProcess -> Effect DeleteChildResult
Deletes a child within the one_for_one supervisor referred to by SupervisorRef childStartArg childProcess
See also supervisor:deleted_child in the OTP documentation