Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module contains:
- Functions exported on the public API
- High level message handlers of the supervisor thread loop
Synopsis
- class HasSupervisor a where
- getSupervisor :: a m -> Supervisor m
- forkWorker :: (MonadIO m, HasSupervisor supervisor) => WorkerOptions m -> supervisor m -> m WorkerId
- forkSupervisor :: (MonadIO m, HasSupervisor parentSupervisor) => SupervisorOptions m -> parentSupervisor m -> m (Supervisor m)
- forkCapataz :: (MonadUnliftIO m, MonadIO m) => Text -> (CapatazOptions m -> CapatazOptions m) -> m (Capataz m)
- terminateProcess :: (MonadIO m, HasSupervisor supervisor) => Text -> ProcessId -> supervisor m -> m Bool
- terminateCapataz :: MonadIO m => Capataz m -> m TeardownResult
- terminateCapataz_ :: MonadIO m => Capataz m -> m ()
- joinCapatazThread :: MonadIO m => Capataz m -> m ()
- getSupervisorProcessId :: Supervisor m -> ProcessId
- getSupervisorAsync :: Supervisor m -> Async ()
- getCapatazTeardown :: Capataz m -> Teardown
Documentation
class HasSupervisor a where Source #
Utility typeclass to call public supervision API with types that contain a supervisor (e.g. Capataz record).
getSupervisor :: a m -> Supervisor m Source #
Fetches a supervisor from a record internals.
Instances
HasSupervisor Capataz Source # | |
Defined in Control.Concurrent.Capataz.Internal.Core getSupervisor :: Capataz m -> Supervisor m Source # | |
HasSupervisor Supervisor Source # | |
Defined in Control.Concurrent.Capataz.Internal.Core getSupervisor :: Supervisor m -> Supervisor m Source # |
:: (MonadIO m, HasSupervisor supervisor) | |
=> WorkerOptions m | Worker options (restart, name, callbacks, etc) |
-> supervisor m |
|
-> m WorkerId | An identifier that can be used to terminate the |
Creates a green thread from an IO ()
sub-routine. Depending in options
defined in the WorkerOptions
record, it will automatically restart this
sub-routine in case of failures.
See documentation of related functions:
:: (MonadIO m, HasSupervisor parentSupervisor) | |
=> SupervisorOptions m | Supervisor options |
-> parentSupervisor m | Parent supervisor instance that supervises new supervisor |
-> m (Supervisor m) | A record used to dynamically create and supervise other processes |
Creates a green thread which monitors other green threads for failures and
restarts them using settings defined on SupervisorOptions
.
See documentation of related functions:
buildSupervisorOptionsWithDefault
buildSupervisorOptions
forkCapataz :: (MonadUnliftIO m, MonadIO m) => Text -> (CapatazOptions m -> CapatazOptions m) -> m (Capataz m) Source #
Creates a Capataz record, which holds both a root supervisor and a
Teardown
to shut down the system. The root supervisor monitors failures on
process threads defined with CapatazOptions
or created
dynamically using forkWorker
or forkSupervisor
.
terminateProcess :: (MonadIO m, HasSupervisor supervisor) => Text -> ProcessId -> supervisor m -> m Bool Source #
terminateCapataz :: MonadIO m => Capataz m -> m TeardownResult Source #
Terminates a Capataz
system (all supervised threads) and returns a TeardownResult
Since: 0.2.0.0
terminateCapataz_ :: MonadIO m => Capataz m -> m () Source #
Terminates a Capataz
system (all supervised threads)
Since: 0.2.0.0
joinCapatazThread :: MonadIO m => Capataz m -> m () Source #
Joins the thread of the root supervisor of the given capataz system to the current thread.
getSupervisorProcessId :: Supervisor m -> ProcessId Source #
Gets the process identifier of a Supervisor
; normally used for termination.
getSupervisorAsync :: Supervisor m -> Async () Source #