Safe Haskell | None |
---|
Worker can be in one of three states
- Uninitialized
- Uninitialized worker is a worker that has a name,
a socket, possibly
WData
but has not been forker - Initialized
- Initialized worker has an associated forker process.
- Active
- A worker is active if it's initialized and it's being used
a client. Active/inactive workers are managed by a
WorkersPool
.
- data Worker a = Worker {}
- type RestartWorker m a = Worker a -> m (Worker a)
- class WorkerData w where
- data IOWorker
- data ProtocolException
- initialized :: Worker a -> Bool
Workers
A datatype representing a worker of type a
Worker | |
|
type RestartWorker m a = Worker a -> m (Worker a)Source
A worker restarting function
class WorkerData w Source
Types of data attached to a worker. This might be a configuration file, a size of the packet, session data, etc.
Data that saves after restarts
Monad in which the worker runs
A simple type of worker that executes IO actions
The definition of the WorkerData
instance for IOWorker looks like this:
instance WorkerData IOWorker where type WData IOWorker = () type WMonad IOWorker = IO
Other types
data ProtocolException Source
An exception type used by Protocol
ConversionException String | There has been an error during the conversion step |
HandleException IOException | There has been an error while using the handler |
Helper functions
initialized :: Worker a -> BoolSource
Check whether the worker is initialized