Module

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

data ChildType

This maps to supervisor | worker as per the underlying supervisor API

Constructors

#ChildNotStartedReason Source

data ChildNotStartedReason childProcess

#StartChildResult Source

#ErlChildSpec Source

#Flags Source

type Flags = { intensity :: Int, period :: Seconds, strategy :: Strategy }

The flags for a supervision tree, mapping onto sup_flags from the underlying supervisor API

#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

#SupervisorPid Source

#SupervisorType Source

#spec Source

spec :: forall childProcess. HasPid childProcess => ChildSpec childProcess -> ErlChildSpec

#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