distributed-process-extras-0.3.5: Cloud Haskell Extras

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

Control.Distributed.Process.Extras.Monitoring

Description

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.

Synopsis

Documentation

data NodeUp Source #

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

Constructors

NodeUp !NodeId 

Instances

Show NodeUp Source # 
Generic NodeUp Source # 

Associated Types

type Rep NodeUp :: * -> * #

Methods

from :: NodeUp -> Rep NodeUp x #

to :: Rep NodeUp x -> NodeUp #

Binary NodeUp Source # 

Methods

put :: NodeUp -> Put #

get :: Get NodeUp #

putList :: [NodeUp] -> Put #

NFData NodeUp Source # 

Methods

rnf :: NodeUp -> () #

type Rep NodeUp Source # 
type Rep NodeUp = D1 * (MetaData "NodeUp" "Control.Distributed.Process.Extras.Monitoring" "distributed-process-extras-0.3.5-7qzKH0dWmcLBNm6JMkdrjz" False) (C1 * (MetaCons "NodeUp" PrefixI False) (S1 * (MetaSel (Nothing Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 * NodeId)))

data NodeDown Source #

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

Constructors

NodeDown !NodeId 

Instances

Show NodeDown Source # 
Generic NodeDown Source # 

Associated Types

type Rep NodeDown :: * -> * #

Methods

from :: NodeDown -> Rep NodeDown x #

to :: Rep NodeDown x -> NodeDown #

Binary NodeDown Source # 

Methods

put :: NodeDown -> Put #

get :: Get NodeDown #

putList :: [NodeDown] -> Put #

NFData NodeDown Source # 

Methods

rnf :: NodeDown -> () #

type Rep NodeDown Source # 
type Rep NodeDown = D1 * (MetaData "NodeDown" "Control.Distributed.Process.Extras.Monitoring" "distributed-process-extras-0.3.5-7qzKH0dWmcLBNm6JMkdrjz" False) (C1 * (MetaCons "NodeDown" PrefixI False) (S1 * (MetaSel (Nothing Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 * 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.