Pinto.Sup
- Package
- erl-pinto
- Repository
- id3as/purescript-erl-pinto
This module defines the means to define a supervisor and its children
For example
import Pinto as Pinto
import Pinto.Sup
startLink :: Effect Pinto.StartLinkResult
startLink = Sup.startLink "my_cool_sup" init
init :: Effect SupervisorSpec
init = do
pure $ buildSupervisor
# supervisorStrategy OneForOne
# supervisorChildren ( ( buildChild
# childType GenServer
# childId "some_child"
# childStart MyGenServer.startLink unit)
: nil)
#startSimpleChild Source
startSimpleChild :: forall args. ChildTemplate args -> SupervisorName -> args -> Effect StartChildResult
Dynamically starts a child with the supplied name and args as specified with the child template See also: supervisor:start_child in the OTP docs
#startSpeccedChild Source
startSpeccedChild :: SupervisorName -> SupervisorChildSpec -> Effect StartChildResult
Dynamically starts a child with the supplied spec See also: supervisor:start_child in the OTP docs
#terminateChild Source
terminateChild :: SupervisorName -> String -> Effect Unit
#deleteChild Source
deleteChild :: SupervisorName -> String -> Effect Unit
#startLink Source
startLink :: SupervisorName -> Effect SupervisorSpec -> Effect StartLinkResult
Starts a supervisor with the supplied name, using the supplied SupervisorSpec This is effectful to allow for reading of config/etc See also: supervisor:start_child in the OTP docs
#BoxedStartFn Source
data BoxedStartFn :: Type
#BoxedStartArgs Source
data BoxedStartArgs :: Type
#SupervisorSpec Source
type SupervisorSpec = { children :: List SupervisorChildSpec, intensity :: Int, period :: Int, strategy :: SupervisorStrategy }
This type is not used directly, but is here to support the buildSupervisor hierarchy
#SupervisorStrategy Source
data SupervisorStrategy
See also supervisor:strategy() Maps to simple_one_for_one | one_for_one .. etc
Constructors
#SupervisorChildType Source
#SupervisorChildRestart Source
#SupervisorChildShutdown Source
#SupervisorChildSpec Source
type SupervisorChildSpec = { id :: String, restart :: SupervisorChildRestart, shutdown :: SupervisorChildShutdown, startArgs :: BoxedStartArgs, startFn :: BoxedStartFn, type_ :: SupervisorChildType }
This type is not used directly, but is here to support the buildSupervisor hierarchy
#ReifiedSupervisorSpec Source
type ReifiedSupervisorSpec = Tuple2 ReifiedSupervisorFlags (List ReifiedSupervisorChild)
This type is not used directly, but is here to support the buildSupervisor hierarchy
#ReifiedSupervisorFlags Source
type ReifiedSupervisorFlags = Tuple3 Atom Int Int
This type is not used directly, but is here to support the buildSupervisor hierarchy
#ReifiedSupervisorChild Source
type ReifiedSupervisorChild = { id :: Atom, restart :: Atom, shutdown :: ReifiedChildShutdown, start :: Tuple3 Atom Atom (List Foreign), type :: Atom }
This type is not used directly, but is here to support the buildSupervisor hierarchy
#ReifiedChildShutdown Source
data ReifiedChildShutdown :: Type
This type is not used directly, but is here to support the buildSupervisor hierarchy
#buildSupervisor Source
buildSupervisor :: SupervisorSpec
Creates a supervisor with default options and no children
#buildChild Source
buildChild :: SupervisorChildSpec
Creates a supervisor child with default options and no actual functionality
#supervisorStrategy Source
supervisorStrategy :: SupervisorStrategy -> SupervisorSpec -> SupervisorSpec
Sets the 'strategy' for the supervisor spec See also the OTP docs for supervisor specs
#supervisorIntensity Source
supervisorIntensity :: Int -> SupervisorSpec -> SupervisorSpec
Sets the 'intensity' for the supervisor spec See also the OTP docs for supervisor specs
#supervisorPeriod Source
supervisorPeriod :: Int -> SupervisorSpec -> SupervisorSpec
Sets the 'period' for the supervisor spec See also the OTP docs for supervisor specs
#supervisorChildren Source
supervisorChildren :: (List SupervisorChildSpec) -> SupervisorSpec -> SupervisorSpec
Provide a list of child specs for this supervisor structure
#childType Source
childType :: SupervisorChildType -> SupervisorChildSpec -> SupervisorChildSpec
Sets the 'child_type' of a child spec See also the OTP docs for supervisor specs
#childShutdown Source
childShutdown :: SupervisorChildShutdown -> SupervisorChildSpec -> SupervisorChildSpec
Sets the 'shutdown' of a child spec See also the OTP docs for supervisor specs
#childId Source
childId :: String -> SupervisorChildSpec -> SupervisorChildSpec
Sets the 'id' of a child spec See also the OTP docs for supervisor specs
#childStartTemplate Source
childStartTemplate :: forall args. ChildTemplate args -> SupervisorChildSpec -> SupervisorChildSpec
Configures the template for the children started by this supervisor See also the OTP docs for supervisor specs
#childRestart Source
childRestart :: SupervisorChildRestart -> SupervisorChildSpec -> SupervisorChildSpec
Sets the 'restart' value of a child spec See also the OTP docs for supervisor specs
#childStart Source
childStart :: forall args. (args -> Effect StartLinkResult) -> args -> SupervisorChildSpec -> SupervisorChildSpec
Sets the callback and args for starting the child
#reify Source
reify :: SupervisorSpec -> ReifiedSupervisorSpec
Internal function to support the buildSupervisor hierarchy
#reifySupervisorFlags Source
reifySupervisorFlags :: SupervisorSpec -> ReifiedSupervisorFlags
Internal function to support the buildSupervisor hierarchy
#reifySupervisorChildren Source
reifySupervisorChildren :: SupervisorSpec -> (List ReifiedSupervisorChild)
Internal function to support the buildSupervisor hierarchy
#reifySupervisorChild Source
reifySupervisorChild :: SupervisorChildSpec -> ReifiedSupervisorChild
Internal function to support the buildSupervisor hierarchy