Safe Haskell | None |
---|---|
Language | Haskell98 |
Types used throughout the Extras package
- type Tag = Int
- type TagPool = MVar Tag
- newTagPool :: Process TagPool
- getTag :: TagPool -> Process Tag
- class Linkable a where
- class Killable p where
- class Resolvable a where
- class Routable a where
- class Monitored a r m | a r -> m where
- class (Resolvable a, Routable a) => Addressable a
- data Recipient
- = Pid !ProcessId
- | Registered !String
- | RemoteRegistered !String !NodeId
- data RegisterSelf = RegisterSelf
- whereisRemote :: NodeId -> String -> Process (Maybe ProcessId)
- resolveOrDie :: Resolvable a => a -> String -> Process ProcessId
- data CancelWait = CancelWait
- type Channel a = (SendPort a, ReceivePort a)
- data Shutdown = Shutdown
- data ExitReason
- newtype ServerDisconnected = ServerDisconnected DiedReason
- class (NFData a, Serializable a) => NFSerializable a
Tagging
Tags provide uniqueness for messages, so that they can be matched with their response.
type TagPool = MVar Tag Source #
Generates unique Tag
for messages and response pairs.
Each process that depends, directly or indirectly, on
the call mechanisms in Control.Distributed.Process.Global.Call
should have at most one TagPool on which to draw unique message
tags.
newTagPool :: Process TagPool Source #
Create a new per-process source of unique message identifiers.
Addressing
class Linkable a where Source #
Class of things to which a Process
can link itself.
linkTo :: Resolvable a => a -> Process () Source #
Create a link with the supplied object.
class Killable p where Source #
Class of things that can be killed (or instructed to exit).
killProc :: Resolvable p => p -> String -> Process () Source #
Kill (instruct to exit) generic process, using kill
primitive.
exitProc :: (Resolvable p, Serializable m) => p -> m -> Process () Source #
Kill (instruct to exit) generic process, using exit
primitive.
Resolvable p => Killable p Source # | |
class Resolvable a where Source #
Class of things that can be resolved to a ProcessId
.
class Routable a where Source #
Class of things that you can route/send serializable message to
sendTo :: (Serializable m, Resolvable a) => a -> m -> Process () Source #
Send a message to the target asynchronously
unsafeSendTo :: (NFSerializable m, Resolvable a) => a -> m -> Process () Source #
Send some NFData
message to the target asynchronously,
forcing evaluation (i.e., deepseq
) beforehand.
class (Resolvable a, Routable a) => Addressable a Source #
A simple means of mapping to a receiver.
data RegisterSelf Source #
Used internally in whereisOrStart. Sent as (RegisterSelf,ProcessId).
Interactions
whereisRemote :: NodeId -> String -> Process (Maybe ProcessId) Source #
A synchronous version of whereis
, this monitors the remote node
and returns Nothing
if the node goes down (since a remote node failing
or being non-contactible has the same effect as a process not being
registered from the caller's point of view).
resolveOrDie :: Resolvable a => a -> String -> Process ProcessId Source #
resolve the Resolvable or die with specified msg plus details of what didn't resolve
data CancelWait Source #
Wait cancellation message.
type Channel a = (SendPort a, ReceivePort a) Source #
Simple representation of a channel.
A ubiquitous shutdown signal that can be used to maintain a consistent shutdown/stop protocol for any process that wishes to handle it.
data ExitReason Source #
Provides a reason for process termination.
ExitNormal | indicates normal exit |
ExitShutdown | normal response to a |
ExitOther !String | abnormal (error) shutdown |
newtype ServerDisconnected Source #
Given when a server is unobtainable.
class (NFData a, Serializable a) => NFSerializable a Source #
Introduces a class that brings NFData into scope along with Serializable,
such that we can force evaluation. Intended for use with the UnsafePrimitives
module (which wraps Control.Distributed.Process.UnsafePrimitives), and
guarantees evaluatedness in terms of NFData
. Please note that we cannot
guarantee that an NFData
instance will behave the same way as a Binary
one with regards evaluation, so it is still possible to introduce unexpected
behaviour by using unsafe primitives in this way.
(NFData a, Serializable a) => NFSerializable a Source # | |
NFSerializable a => NFSerializable (SendPort a) Source # | |