Pinto.Supervisor
- Package
- erl-pinto
- Repository
- id3as/purescript-erl-pinto
This module represents supervisor in OTP See also gen_supervisor in the OTP docs (https://erlang.org/doc/man/supervisor.html#)
#ChildShutdownTimeoutStrategy Source
data ChildShutdownTimeoutStrategy
This maps to brutal | infinity | { timeout, Milliseconds } as per the underlying supervisor API
Constructors
#ChildSpec Source
type ChildSpec childProcess = { childType :: ChildType, id :: String, restartStrategy :: RestartStrategy, shutdownStrategy :: ChildShutdownTimeoutStrategy, start :: Effect (StartLinkResult childProcess) }
The specification of a child process, this maps to ChildSpec in the underlying supervisor API with the difference that none of them are optional.
childProcess
is the typed pid of the started process (commonly GenServer.ServerPid)
#ChildType Source
#ChildNotStartedReason Source
data ChildNotStartedReason childProcess
#StartChildResult Source
data StartChildResult childProcess
Constructors
ChildAlreadyPresent
ChildAlreadyStarted childProcess
ChildStartReturnedIgnore
ChildFailed Foreign
ChildStarted { info :: Maybe Foreign, pid :: childProcess }
#ErlChildSpec Source
data ErlChildSpec :: Type
#RestartStrategy Source
data RestartStrategy
This maps to transient | permanent | temporary as per the underlying supervisor API
Constructors
#Strategy Source
data Strategy
The strategy employed by this supervision tree, this maps to one_for_all | one_for_one | rest_for_one in the underlying supervisor API
Note: simple_one_for_one is deliberately missing, see: Supervisor.SimpleOneForOne
Constructors
#SupervisorSpec Source
type SupervisorSpec = { childSpecs :: List ErlChildSpec, flags :: Flags }
A complete specification for a supervisor, see Result
in the underlying supervisor API
#SupervisorType Source
newtype SupervisorType
#spec Source
spec :: forall childProcess. HasPid childProcess => ChildSpec childProcess -> ErlChildSpec
#startLink Source
startLink :: Maybe (RegistryName SupervisorType) -> Effect SupervisorSpec -> Effect (StartLinkResult SupervisorPid)
Given an (optional) name for the supervisor an effect that will be executed within the context of the new supervisor execute that effect to get the specification and start a supervisor with that specification
#startChild Source
startChild :: forall childProcess. HasPid childProcess => SupervisorRef -> ChildSpec childProcess -> StartChildResult childProcess
Given a supervisor reference and a child specification start a new child within the context of that supervisor See also supervisor:start_child
#terminateChild Source
terminateChild :: SupervisorRef -> String -> Effect TerminateChildResult
Given a supervisor reference and a child id terminate that given child See also supervisor:terminate_child
#deleteChild Source
deleteChild :: SupervisorRef -> String -> Effect DeleteChildResult
Given a supervisor reference and a child id delete that given child See also supervisor:delete_child
#stop Source
stop :: SupervisorRef -> Effect Unit
A convenience mechanism to stop a supervisor using sys:terminate
#maybeChildStarted Source
maybeChildStarted :: forall childProcess. StartChildResult childProcess -> Maybe childProcess
Converts a StartChildResult into a Maybe returning Just if the child was started and Nothing otherwise
#maybeChildRunning Source
maybeChildRunning :: forall childProcess. StartChildResult childProcess -> Maybe childProcess
Converts a StartChildResult into a Maybe returning Just if the child was started and Just if the child was already running and Nothing otherwise
#crashIfChildNotStarted Source
crashIfChildNotStarted :: forall childProcess. StartChildResult childProcess -> childProcess
#crashIfChildNotRunning Source
crashIfChildNotRunning :: forall childProcess. StartChildResult childProcess -> childProcess