Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module contains:
- Functions exported on the public API
- High level message handlers of the supervisor thread loop
- class HasSupervisor a where
- forkWorker :: HasSupervisor supervisor => WorkerOptions -> supervisor -> IO WorkerId
- forkSupervisor :: HasSupervisor parentSupervisor => SupervisorOptions -> parentSupervisor -> IO Supervisor
- forkCapataz :: Text -> (CapatazOptions -> CapatazOptions) -> IO Capataz
- terminateProcess :: HasSupervisor supervisor => Text -> ProcessId -> supervisor -> IO Bool
- joinCapatazThread :: Capataz -> IO ()
- getSupervisorProcessId :: Supervisor -> ProcessId
- getSupervisorAsync :: Supervisor -> Async ()
- getCapatazTeardown :: Capataz -> 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 -> Supervisor Source #
Fetches a supervisor from a record internals.
:: HasSupervisor supervisor | |
=> WorkerOptions | Worker options (restart, name, callbacks, etc) |
-> supervisor | Supervisor that supervises the worker |
-> IO WorkerId | An identifier that can be used to terminate the Worker |
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:
- "buildWorkerOptionsWithDefault"
- "buildWorkerOptions"
:: HasSupervisor parentSupervisor | |
=> SupervisorOptions | Supervisor options |
-> parentSupervisor | Parent supervisor instance that supervises new supervisor |
-> IO Supervisor | 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 :: Text -> (CapatazOptions -> CapatazOptions) -> IO Capataz 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 "supervisorProcessSpecList" or created dynamically using "forkWorker" or "forkSupervisor".
terminateProcess :: HasSupervisor supervisor => Text -> ProcessId -> supervisor -> IO Bool Source #
joinCapatazThread :: Capataz -> IO () Source #
Joins the thread of the root supervisor of the given capataz system to the current thread.
getSupervisorProcessId :: Supervisor -> ProcessId Source #
Gets the process identifier of a Supervisor; normally used for termination.
getSupervisorAsync :: Supervisor -> Async () Source #