Safe Haskell | None |
---|
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.
- newtype NodeId = NodeId {}
- data LocalProcessId = LocalProcessId {
- lpidUnique :: !Int32
- lpidCounter :: !Int32
- data ProcessId = ProcessId {}
- data Identifier
- nodeOf :: Identifier -> NodeId
- data LocalNode = LocalNode {}
- data LocalNodeState = LocalNodeState {}
- data LocalProcess = LocalProcess {}
- data LocalProcessState = LocalProcessState {}
- newtype Process a = Process {
- unProcess :: ReaderT LocalProcess IO a
- runLocalProcess :: LocalProcess -> Process a -> IO a
- type LocalSendPortId = Int32
- data SendPortId = SendPortId {}
- data TypedChannel = forall a . Serializable a => TypedChannel (TChan a)
- newtype SendPort a = SendPort {}
- data ReceivePort a
- = ReceivePortSingle (TChan a)
- | ReceivePortBiased [ReceivePort a]
- | ReceivePortRR (TVar [ReceivePort a])
- data Message = Message {}
- createMessage :: Serializable a => a -> Message
- messageToPayload :: Message -> [ByteString]
- payloadToMessage :: [ByteString] -> Message
- data MonitorRef = MonitorRef {}
- data ProcessMonitorNotification = ProcessMonitorNotification MonitorRef ProcessId DiedReason
- data NodeMonitorNotification = NodeMonitorNotification MonitorRef NodeId DiedReason
- data PortMonitorNotification = PortMonitorNotification MonitorRef SendPortId DiedReason
- data ProcessLinkException = ProcessLinkException ProcessId DiedReason
- data NodeLinkException = NodeLinkException NodeId DiedReason
- data PortLinkException = PortLinkException SendPortId DiedReason
- data DiedReason
- newtype DidUnmonitor = DidUnmonitor MonitorRef
- newtype DidUnlinkProcess = DidUnlinkProcess ProcessId
- newtype DidUnlinkNode = DidUnlinkNode NodeId
- newtype DidUnlinkPort = DidUnlinkPort SendPortId
- newtype SpawnRef = SpawnRef Int32
- data DidSpawn = DidSpawn SpawnRef ProcessId
- data WhereIsReply = WhereIsReply String (Maybe ProcessId)
- data NCMsg = NCMsg {}
- data ProcessSignal
- = Link Identifier
- | Unlink Identifier
- | Monitor MonitorRef
- | Unmonitor MonitorRef
- | Died Identifier DiedReason
- | Spawn (Closure (Process ())) SpawnRef
- | WhereIs String
- | Register String (Maybe ProcessId)
- | NamedSend String Message
- | Reconnect Identifier
- localProcesses :: Accessor LocalNodeState (Map LocalProcessId LocalProcess)
- localPidCounter :: Accessor LocalNodeState Int32
- localPidUnique :: Accessor LocalNodeState Int32
- localConnections :: Accessor LocalNodeState (Map (Identifier, Identifier) Connection)
- localProcessWithId :: LocalProcessId -> Accessor LocalNodeState (Maybe LocalProcess)
- localConnectionBetween :: Identifier -> Identifier -> Accessor LocalNodeState (Maybe Connection)
- monitorCounter :: Accessor LocalProcessState Int32
- spawnCounter :: Accessor LocalProcessState Int32
- channelCounter :: Accessor LocalProcessState LocalSendPortId
- typedChannels :: Accessor LocalProcessState (Map LocalSendPortId TypedChannel)
- typedChannelWithId :: LocalSendPortId -> Accessor LocalProcessState (Maybe TypedChannel)
Node and process identifiers
Node identifier
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
LocalProcessId | |
|
Process identifier
ProcessId | |
|
data Identifier Source
Union of all kinds of identifiers
nodeOf :: Identifier -> NodeIdSource
Local nodes and processes
Local nodes
LocalNode | |
|
data LocalNodeState Source
Local node state
data LocalProcessState Source
Local process state
The Cloud Haskell Process
type
runLocalProcess :: LocalProcess -> Process a -> IO aSource
Deconstructor for Process
(not exported to the public API)
Typed channels
type LocalSendPortId = Int32Source
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.
SendPortId | |
|
data TypedChannel Source
forall a . Serializable a => TypedChannel (TChan a) |
The send send of a typed channel (serializable)
SendPort | |
|
data ReceivePort a Source
The receive end of a typed channel (not serializable)
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
Messages consist of their typeRep fingerprint and their encoding
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
MonitorRef | |
|
data ProcessMonitorNotification Source
Message sent by process monitors
data NodeMonitorNotification Source
Message sent by node monitors
data PortMonitorNotification Source
Message sent by channel (port) monitors
data ProcessLinkException Source
Exceptions thrown when a linked process dies
data NodeLinkException Source
Exception thrown when a linked node dies
data PortLinkException Source
Exception thrown when a linked channel (port) dies
data DiedReason Source
Why did a process die?
DiedNormal | Normal termination |
DiedException String | The process exited with an exception
(provided as |
DiedDisconnect | We got disconnected from the process node |
DiedNodeDown | The process node died |
DiedUnknownId | Invalid (processnodechannel) identifier |
newtype DidUnmonitor Source
(Asynchronous) reply from unmonitor
newtype DidUnlinkProcess Source
(Asynchronous) reply from unlink
newtype DidUnlinkNode Source
(Asynchronous) reply from unlinkNode
newtype DidUnlinkPort Source
(Asynchronous) reply from unlinkPort
SpawnRef
are used to return pids of spawned processes
(Asynchronius) reply from spawn
data WhereIsReply Source
(Asynchronous) reply from whereis
Node controller internal data types
Messages to the node controller
data ProcessSignal Source
Signals to the node controller (see NCMsg
)