Safe Haskell | None |
---|---|
Language | Haskell98 |
Control.Distributed.Process.Extras.Internal.Types
Contents
Description
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 Killable p where Source #
Class of things that can be killed (or instructed to exit).
Methods
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.
Instances
Resolvable p => Killable p Source # | |
class Resolvable a where Source #
Class of things that can be resolved to a ProcessId
.
Minimal complete definition
Methods
resolve :: a -> Process (Maybe ProcessId) Source #
Resolve the reference to a process id, or Nothing
if resolution fails
unresolvableMessage :: Resolvable a => a -> String Source #
Unresolvable Addressable
Message
Instances
class Routable a where Source #
Class of things that you can route/send serializable message to
Methods
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 #
Instances
A simple means of mapping to a receiver.
Constructors
Pid !ProcessId | |
Registered !String | |
RemoteRegistered !String !NodeId |
data RegisterSelf Source #
Used internally in whereisOrStart. Sent as (RegisterSelf,ProcessId).
Constructors
RegisterSelf |
Instances
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
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.
Constructors
Shutdown |
data ExitReason Source #
Provides a reason for process termination.
Constructors
ExitNormal | indicates normal exit |
ExitShutdown | normal response to a |
ExitOther !String | abnormal (error) shutdown |
Instances
newtype ServerDisconnected Source #
Given when a server is unobtainable.
Constructors
ServerDisconnected DiedReason |
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.
Instances
(NFData a, Serializable a) => NFSerializable a Source # | |
NFSerializable a => NFSerializable (SendPort a) Source # | |