distributed-process-0.3.1: Cloud Haskell: Erlang-style concurrency in Haskell

Safe HaskellNone

Control.Distributed.Process.Internal.Types

Contents

Description

Types used throughout the Cloud Haskell framework

We collect all types used internally in a single module because many of these data types are mutually recursive and cannot be split across modules.

Synopsis

Node and process identifiers

newtype NodeId Source

Node identifier

Constructors

NodeId 

data LocalProcessId Source

A local process ID consists of a seed which distinguishes processes from different instances of the same local node and a counter

Constructors

LocalProcessId 

data ProcessId Source

Process identifier

Constructors

ProcessId 

Fields

processNodeId :: !NodeId

The ID of the node the process is running on

processLocalId :: !LocalProcessId

Node-local identifier for the process

Local nodes and processes

data LocalNode Source

Local nodes

Constructors

LocalNode 

Fields

localNodeId :: NodeId

NodeId of the node

localEndPoint :: EndPoint

The network endpoint associated with this node

localState :: StrictMVar LocalNodeState

Local node state

localCtrlChan :: Chan NCMsg

Channel for the node controller

remoteTable :: RemoteTable

Runtime lookup table for supporting closures TODO: this should be part of the CH state, not the local endpoint state

Instances

runLocalProcess :: LocalProcess -> Process a -> IO aSource

Deconstructor for Process (not exported to the public API)

Typed channels

data SendPortId Source

A send port is identified by a SendPortId.

You cannot send directly to a SendPortId; instead, use newChan to create a SendPort.

Constructors

SendPortId 

Fields

sendPortProcessId :: !ProcessId

The ID of the process that will receive messages sent on this port

sendPortLocalId :: !LocalSendPortId

Process-local ID of the channel

data TypedChannel Source

Constructors

forall a . Serializable a => TypedChannel (TChan a) 

newtype SendPort a Source

The send send of a typed channel (serializable)

Constructors

SendPort 

Fields

sendPortId :: SendPortId

The (unique) ID of this send port

data ReceivePort a Source

The receive end of a typed channel (not serializable)

Constructors

ReceivePortSingle (TChan a)

A single receive port

ReceivePortBiased [ReceivePort a]

A left-biased combination of receive ports

ReceivePortRR (TVar [ReceivePort a])

A round-robin combination of receive ports

Messages

data Message Source

Messages consist of their typeRep fingerprint and their encoding

Instances

createMessage :: Serializable a => a -> MessageSource

Turn any serialiable term into a message

messageToPayload :: Message -> [ByteString]Source

Serialize a message

payloadToMessage :: [ByteString] -> MessageSource

Deserialize a message

Node controller user-visible data types

data MonitorRef Source

MonitorRef is opaque for regular Cloud Haskell processes

Constructors

MonitorRef 

Fields

monitorRefIdent :: !Identifier

ID of the entity to be monitored

monitorRefCounter :: !Int32

Unique to distinguish multiple monitor requests by the same process

data PortLinkException Source

Exception thrown when a linked channel (port) dies

data DiedReason Source

Why did a process die?

Constructors

DiedNormal

Normal termination

DiedException String

The process exited with an exception (provided as String because Exception does not implement Binary)

DiedDisconnect

We got disconnected from the process node

DiedNodeDown

The process node died

DiedUnknownId

Invalid (processnodechannel) identifier

newtype DidUnmonitor Source

(Asynchronous) reply from unmonitor

Constructors

DidUnmonitor MonitorRef 

newtype DidUnlinkProcess Source

(Asynchronous) reply from unlink

newtype DidUnlinkNode Source

(Asynchronous) reply from unlinkNode

Constructors

DidUnlinkNode NodeId 

newtype DidUnlinkPort Source

(Asynchronous) reply from unlinkPort

newtype SpawnRef Source

SpawnRef are used to return pids of spawned processes

Constructors

SpawnRef Int32 

data DidSpawn Source

(Asynchronius) reply from spawn

data WhereIsReply Source

(Asynchronous) reply from whereis

Node controller internal data types

data NCMsg Source

Messages to the node controller

Instances

Accessors