Safe Haskell | None |
---|
This module contains functions that let one easily implement the worker side of an adapter under the assumption that the worker uses a two-way communication channel with the supervisor for sending and receiving messages. (Examples of when this is NOT the case is the threads adapter, where you can communicate with the worker threads directly, and the MPI adapter, which has communication primitives that don't quite align with this setup.)
- data ConnectionLost = ConnectionLost
- runWorker :: forall exploration_mode m n. ExplorationMode exploration_mode -> Purity m n -> TreeT m (ResultFor exploration_mode) -> IO MessageForWorker -> (MessageForSupervisorFor exploration_mode -> IO ()) -> IO ()
- runWorkerUsingHandles :: (Serialize (ProgressFor exploration_mode), Serialize (WorkerFinishedProgressFor exploration_mode)) => ExplorationMode exploration_mode -> Purity m n -> TreeT m (ResultFor exploration_mode) -> Handle -> Handle -> IO ()
Exceptions
data ConnectionLost Source
This exception is thrown when the connection has been lost.
Functions
:: forall exploration_mode m n . | |
=> ExplorationMode exploration_mode | the mode in to explore the tree |
-> Purity m n | the purity of the tree |
-> TreeT m (ResultFor exploration_mode) | the tree |
-> IO MessageForWorker | the action used to fetch the next message |
-> (MessageForSupervisorFor exploration_mode -> IO ()) | the action to send a message to the supervisor; note that this might occur in a different thread from the worker loop |
-> IO () |
Runs a loop that continually fetches and reacts to messages from the supervisor until the worker quits.
:: (Serialize (ProgressFor exploration_mode), Serialize (WorkerFinishedProgressFor exploration_mode)) | |
=> ExplorationMode exploration_mode | the mode in to explore the tree |
-> Purity m n | the purity of the tree |
-> TreeT m (ResultFor exploration_mode) | the tree |
-> Handle | handle from which messages from the supervisor are read |
-> Handle | handle to which messages to the supervisor are written |
-> IO () |
The same as runWorker
, but it lets you provide handles through which the
messages will be sent and received. (Note that the reading and writing
handles might be the same.)