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 :: WorkerId -> WorkerName -> IO ()
- getProcessId :: Process -> ProcessId
- fetchProcess :: SupervisorEnv -> ProcessId -> IO (Maybe Process)
- appendProcessToMap :: SupervisorEnv -> Process -> IO ()
- removeProcessFromMap :: SupervisorEnv -> ProcessId -> IO ()
- resetProcessMap :: SupervisorEnv -> (ProcessMap -> ProcessMap) -> IO ()
- readProcessMap :: SupervisorEnv -> IO ProcessMap
- sortProcessesByTerminationOrder :: ProcessTerminationOrder -> ProcessMap -> [Process]
- readSupervisorStatusSTM :: TVar SupervisorStatus -> STM SupervisorStatus
- readSupervisorStatus :: SupervisorEnv -> IO SupervisorStatus
- writeSupervisorStatus :: SupervisorEnv -> SupervisorStatus -> IO ()
- sendControlMsg :: SupervisorEnv -> ControlAction -> IO ()
- sendSyncControlMsg :: SupervisorEnv -> (IO () -> ControlAction) -> IO ()
- capatazOptionsToSupervisorOptions :: CapatazOptions -> SupervisorOptions
- toParentSupervisorEnv :: SupervisorEnv -> ParentSupervisorEnv
Documentation
setProcessThreadName :: WorkerId -> WorkerName -> IO () Source #
Internal functions that overwrites the GHC thread name, for increasing traceability on GHC internals.
getProcessId :: Process -> ProcessId Source #
Gets the ProcessId of both a Worker or Supervisor process.
fetchProcess :: SupervisorEnv -> ProcessId -> IO (Maybe Process) Source #
Gets a supervised Process from a Supervisor instance.
appendProcessToMap :: SupervisorEnv -> Process -> IO () Source #
Appends a new Process to the Supervisor existing process map.
removeProcessFromMap :: SupervisorEnv -> ProcessId -> IO () Source #
Removes a Process from a Supervisor existing process map.
resetProcessMap :: SupervisorEnv -> (ProcessMap -> ProcessMap) -> IO () Source #
Function to modify a Supervisor process map using a pure function.
readProcessMap :: SupervisorEnv -> IO ProcessMap Source #
Function to get a snapshot of a Supervisor process map.
sortProcessesByTerminationOrder :: ProcessTerminationOrder -> ProcessMap -> [Process] 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 :: SupervisorEnv -> IO SupervisorStatus Source #
Executes transaction that returns the SupervisorStatus.
writeSupervisorStatus :: SupervisorEnv -> SupervisorStatus -> IO () 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 "notifyEvent" sub-routine, orginally given in the CapatazOption record.
sendControlMsg :: SupervisorEnv -> ControlAction -> IO () Source #
Used from public API functions to send ControlAction messages to a Supervisor thread loop.
:: SupervisorEnv | |
-> (IO () -> ControlAction) | Blocking sub-routine used from the caller |
-> IO () |
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 -> SupervisorOptions Source #
Utility function to transform a CapatazOptions record to a SupervisorOptions record.
toParentSupervisorEnv :: SupervisorEnv -> ParentSupervisorEnv Source #
Utility function to transform a SupervisorEnv record to a ParentSupervisorEnv record; used on functions where supervision of supervisors is managed.