Safe Haskell | None |
---|---|
Language | Haskell2010 |
- forkSupervisor :: ParentSupervisorEnv -> SupervisorOptions -> Maybe (ProcessId, RestartCount) -> IO Supervisor
- buildSupervisorEnv :: (CapatazEvent -> IO ()) -> (SupervisorMessage -> IO ()) -> STM SupervisorMessage -> SupervisorId -> SupervisorOptions -> IO SupervisorEnv
- handleMonitorEvent :: SupervisorEnv -> MonitorEvent -> IO Bool
- handleControlAction :: SupervisorEnv -> ControlAction -> IO Bool
- haltSupervisor :: Text -> SupervisorEnv -> IO ()
- handleSupervisorMessage :: SupervisorEnv -> SupervisorMessage -> IO Bool
- supervisorLoop :: (forall b. IO b -> IO b) -> ParentSupervisorEnv -> SupervisorEnv -> RestartCount -> IO ()
- supervisorMain :: ParentSupervisorEnv -> SupervisorOptions -> SupervisorId -> RestartCount -> IO Supervisor
- calcDiffSeconds :: UTCTime -> IO NominalDiffTime
- calcRestartAction :: SupervisorEnv -> Int -> NominalDiffTime -> ProcessRestartAction
- execCapatazRestartStrategy :: SupervisorEnv -> ProcessId -> ProcessSpec -> Int -> IO ()
- execRestartAction :: SupervisorEnv -> ProcessId -> ProcessSpec -> Text -> UTCTime -> Int -> IO ()
- restartProcessList :: SupervisorEnv -> WorkerId -> RestartCount -> IO [Process]
- forceRestartProcess :: SupervisorEnv -> Process -> IO ()
- restartWorker :: SupervisorEnv -> WorkerOptions -> WorkerId -> RestartCount -> IO Process
- restartSupervisor :: ParentSupervisorEnv -> SupervisorOptions -> ProcessId -> RestartCount -> IO Process
- handleWorkerCompleted :: SupervisorEnv -> Worker -> IO ()
- handleProcessCompleted :: SupervisorEnv -> ProcessId -> UTCTime -> IO ()
- handleWorkerFailed :: SupervisorEnv -> Worker -> Int -> IO ()
- handleSupervisorFailed :: SupervisorEnv -> Supervisor -> Int -> IO ()
- handleProcessFailed :: SupervisorEnv -> WorkerId -> SomeException -> Int -> IO ()
- handleWorkerTerminated :: SupervisorEnv -> Worker -> Int -> IO ()
- handleSupervisorTerminated :: SupervisorEnv -> Supervisor -> Int -> IO ()
- handleProcessTerminated :: SupervisorEnv -> ProcessId -> Text -> Int -> IO ()
Documentation
forkSupervisor :: ParentSupervisorEnv -> SupervisorOptions -> Maybe (ProcessId, RestartCount) -> IO Supervisor Source #
Internal function that forks a supervisor thread; note this is different
from the public forkSupervisor
function which sends a message to the
supervisor loop.
buildSupervisorEnv :: (CapatazEvent -> IO ()) -> (SupervisorMessage -> IO ()) -> STM SupervisorMessage -> SupervisorId -> SupervisorOptions -> IO SupervisorEnv Source #
Utility function that builds an utility record which is used on all internal APIs of the supervision logic.
handleMonitorEvent :: SupervisorEnv -> MonitorEvent -> IO Bool Source #
Handles an event produced by one of the processes this supervisor monitors.
handleControlAction :: SupervisorEnv -> ControlAction -> IO Bool Source #
Handles an action triggered by the public Capataz API.
haltSupervisor :: Text -> SupervisorEnv -> IO () Source #
Executes the shutdown operation of a Supervisor, including the termination of its supervised processes.
handleSupervisorMessage :: SupervisorEnv -> SupervisorMessage -> IO Bool Source #
Handles all messages that a Supervisor can receive from its monitored processes or from the public API.
supervisorLoop :: (forall b. IO b -> IO b) -> ParentSupervisorEnv -> SupervisorEnv -> RestartCount -> IO () Source #
This sub-routine executes the main thread loop of a Supervisor instance.
supervisorMain :: ParentSupervisorEnv -> SupervisorOptions -> SupervisorId -> RestartCount -> IO Supervisor Source #
This sub-routine starts a Supervisor thread and initializes its processList.
calcDiffSeconds :: UTCTime -> IO NominalDiffTime Source #
Tracks difference between two timestamps so that we keep track of a Supervisor error intensity.
calcRestartAction :: SupervisorEnv -> Int -> NominalDiffTime -> ProcessRestartAction Source #
Checks restart counts and worker start times to assess if the Supervisor error intensity has been breached, see ProcessRestartAction for possible outcomes.
execCapatazRestartStrategy :: SupervisorEnv -> ProcessId -> ProcessSpec -> Int -> IO () Source #
Sub-routine responsible of executing a SupervisorRestartStrategy.
execRestartAction :: SupervisorEnv -> ProcessId -> ProcessSpec -> Text -> UTCTime -> Int -> IO () Source #
Executes a restart action returned from the invokation of "calcRestartAction".
restartProcessList :: SupervisorEnv -> WorkerId -> RestartCount -> IO [Process] Source #
Restarts _all_ processes that are supervised by Supervisor, invoked when one worker green thread fails and causes sibling process threads to get restarted as well (e.g. AllForOne supervisor restart strategy).
forceRestartProcess :: SupervisorEnv -> Process -> IO () Source #
Sub-routine that is used when there is a restart request sent to a Process caused by an AllForOne restart from a failing sibling process.
restartWorker :: SupervisorEnv -> WorkerOptions -> WorkerId -> RestartCount -> IO Process Source #
Starts a new worker thread taking into account an existing WorkerId and keeping a RestartCount to manage the Supervisor error intensity.
restartSupervisor :: ParentSupervisorEnv -> SupervisorOptions -> ProcessId -> RestartCount -> IO Process Source #
Starts a new Supervisor thread taking into account an existing SupervisorId and keeping a RestartCount to manage the parent Supervisor error intensity.
handleWorkerCompleted :: SupervisorEnv -> Worker -> IO () Source #
Executes restart strategy for when a worker finishes it execution because of a completion (e.g. worker sub-routine finished without any errors).
handleProcessCompleted :: SupervisorEnv -> ProcessId -> UTCTime -> IO () Source #
Executes restart strategy for when a process finishes it execution because of a completion (e.g. worker sub-routine finished without any errors).
handleWorkerFailed :: SupervisorEnv -> Worker -> Int -> IO () Source #
Executes restart strategy for when a worker finishes it execution because of a failure.
handleSupervisorFailed :: SupervisorEnv -> Supervisor -> Int -> IO () Source #
Executes restart strategy for when a supervisor finishes it execution because of a failure.
handleProcessFailed :: SupervisorEnv -> WorkerId -> SomeException -> Int -> IO () Source #
Executes restart strategy for when a process finishes it execution because of a failure.
handleWorkerTerminated :: SupervisorEnv -> Worker -> Int -> IO () Source #
Executes restart strategy for when a worker finishes it execution because of a termination from its supervisor.
handleSupervisorTerminated :: SupervisorEnv -> Supervisor -> Int -> IO () Source #
Executes restart strategy for when a supervisor finishes it execution because of a termination from its parent supervisor.
handleProcessTerminated :: SupervisorEnv -> ProcessId -> Text -> Int -> IO () Source #
Executes restart strategy for when a process finishes it execution because of a termination from its supervisor.