Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module contains:
- Functions to manipulate the state of the Supervisor record
- Utility functions used for communication between threads
- Public API utility functions
- getTidNumber :: ThreadId -> Maybe Text
- setProcessThreadName :: MonadIO m => WorkerId -> WorkerName -> m ()
- getProcessId :: Process m -> ProcessId
- fetchProcess :: MonadIO m => SupervisorEnv m -> ProcessId -> m (Maybe (Process m))
- appendProcessToMap :: MonadIO m => SupervisorEnv m -> Process m -> m ()
- removeProcessFromMap :: MonadIO m => SupervisorEnv m -> ProcessId -> m ()
- resetProcessMap :: MonadIO m => SupervisorEnv m -> (ProcessMap m -> ProcessMap m) -> m ()
- readProcessMap :: MonadIO m => SupervisorEnv m -> m (ProcessMap m)
- sortProcessesByTerminationOrder :: ProcessTerminationOrder -> ProcessMap m -> [Process m]
- readSupervisorStatusSTM :: TVar SupervisorStatus -> STM SupervisorStatus
- readSupervisorStatus :: MonadIO m => SupervisorEnv m -> m SupervisorStatus
- writeSupervisorStatus :: MonadIO m => SupervisorEnv m -> SupervisorStatus -> m ()
- sendControlMsg :: SupervisorEnv m -> ControlAction m -> m ()
- sendSyncControlMsg :: MonadIO m => SupervisorEnv m -> (m () -> ControlAction m) -> m ()
- capatazOptionsToSupervisorOptions :: CapatazOptions m -> SupervisorOptions m
- toParentSupervisorEnv :: SupervisorEnv m -> ParentSupervisorEnv m
Documentation
setProcessThreadName :: MonadIO m => WorkerId -> WorkerName -> m () Source #
Internal functions that overwrites the GHC thread name, for increasing traceability on GHC internals.
getProcessId :: Process m -> ProcessId Source #
Gets the ProcessId
of both a Worker or Supervisor process.
fetchProcess :: MonadIO m => SupervisorEnv m -> ProcessId -> m (Maybe (Process m)) Source #
Gets a supervised Process
from a Supervisor
instance.
appendProcessToMap :: MonadIO m => SupervisorEnv m -> Process m -> m () Source #
Appends a new Process
to the Supervisor
existing process map.
removeProcessFromMap :: MonadIO m => SupervisorEnv m -> ProcessId -> m () Source #
Removes a Process
from a Supervisor
existing process map.
resetProcessMap :: MonadIO m => SupervisorEnv m -> (ProcessMap m -> ProcessMap m) -> m () Source #
Function to modify a Supervisor
process map using a pure function.
readProcessMap :: MonadIO m => SupervisorEnv m -> m (ProcessMap m) Source #
Function to get a snapshot of a Supervisor
process map.
sortProcessesByTerminationOrder :: ProcessTerminationOrder -> ProcessMap m -> [Process m] Source #
Returns all processes of a Supervisor
by ProcessTerminationOrder
. This
is used on AllForOne
restarts and shutdown operations.
readSupervisorStatusSTM :: TVar SupervisorStatus -> STM SupervisorStatus Source #
Returns the SupervisorStatus
, this sub-routine will retry transaction
until its associated Supervisor
has a status different from Initializing
.
readSupervisorStatus :: MonadIO m => SupervisorEnv m -> m SupervisorStatus Source #
Executes transaction that returns the SupervisorStatus
.
writeSupervisorStatus :: MonadIO m => SupervisorEnv m -> SupervisorStatus -> m () Source #
Modifes the Supervisor
status.
IMPORTANT This is the only function that should be used for this purpose
given it has the side-effect of notifying a status change via the
$sel:notifyEvent:ParentSupervisorEnv
sub-routine, orginally given in the CapatazOption
record.
sendControlMsg :: SupervisorEnv m -> ControlAction m -> m () Source #
Used from public API functions to send ControlAction
messages to a
Supervisor thread loop.
:: MonadIO m | |
=> SupervisorEnv m | |
-> (m () -> ControlAction m) | Blocking sub-routine used from the caller |
-> m () |
Used from public API functions to send ControlAction messages to the a Supervisor thread loop, it receives an IO sub-routine that expects an IO operation that blocks a thread until the message is done.
capatazOptionsToSupervisorOptions :: CapatazOptions m -> SupervisorOptions m Source #
Utility function to transform a CapatazOptions
record to a
SupervisorOptions
record.
toParentSupervisorEnv :: SupervisorEnv m -> ParentSupervisorEnv m Source #
Utility function to transform a SupervisorEnv
record to a
ParentSupervisorEnv
record; used on functions where supervision of
supervisors is managed.