distributed-process-extras- Cloud Haskell Extras

Copyright(c) Tim Watson 2013 - 2014
LicenseBSD3 (see the file LICENSE)
MaintainerTim Watson <watson.timothy@gmail.com>
Portabilitynon-portable (requires concurrency)
Safe HaskellNone



This module provides a primitive node monitoring capability, implemented as a distributed-process Management Agent. Once the nodeMonitor agent is started, calling monitorNodes will ensure that whenever the local node detects a new network-transport connection (from another cloud haskell node), the caller will receive a NodeUp message in its mailbox. If a node disconnects, a corollary NodeDown message will be delivered as well.



data NodeUp Source

Sent to subscribing processes when a connection (from a remote node) is detected.


NodeUp !NodeId 

data NodeDown Source

Sent to subscribing processes when a dis-connection (from a remote node) is detected.


NodeDown !NodeId 

nodeMonitorAgentId :: MxAgentId Source

The MxAgentId for the node monitoring agent.

nodeMonitor :: Process ProcessId Source

Starts the node monitoring agent. No call to monitorNodes and unmonitorNodes will have any effect unless the agent is already running. Note that we make no guarantees what-so-ever about the timeliness or ordering semantics of node monitoring notifications.

monitorNodes :: Process () Source

Start monitoring node connection/disconnection events. When a connection event occurs, the calling process will receive a message NodeUp NodeId in its mailbox. When a disconnect occurs, the corollary NodeDown NodeId message will be delivered instead.

No guaranatee is made about the timeliness of the delivery, nor can the receiver expect that the node (for which it is being notified) is still upconnected or downdisconnected at the point when it receives a message from the node monitoring agent.

unmonitorNodes :: Process () Source

Stop monitoring node connection/disconnection events. This does not flush the caller's mailbox, nor does it guarantee that any/all node up/down notifications will have been delivered before it is evaluated.