distributed-process-extras-0.2.1.1: Cloud Haskell Extras

Safe HaskellNone
LanguageHaskell98

Control.Distributed.Process.Extras.Internal.Types

Contents

Description

Types used throughout the Extras package

Synopsis

Tagging

type Tag = Int Source

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.

getTag :: TagPool -> Process Tag Source

Extract a new identifier from a TagPool.

Addressing

class Linkable a where Source

Class of things to which a Process can link itself.

Methods

linkTo :: a -> Process () Source

Create a link with the supplied object.

class Killable a where Source

Class of things that can be killed (or instructed to exit).

Methods

killProc :: a -> String -> Process () Source

exitProc :: Serializable m => a -> m -> Process () Source

class Resolvable a where Source

Class of things that can be resolved to a ProcessId.

Methods

resolve :: a -> Process (Maybe ProcessId) Source

Resolve the reference to a process id, or Nothing if resolution fails

class Routable a where Source

Provides a unified API for addressing processes.

Minimal complete definition

sendTo, unsafeSendTo

Methods

sendTo :: Serializable m => a -> m -> Process () Source

Send a message to the target asynchronously

unsafeSendTo :: NFSerializable m => a -> m -> Process () Source

Send some NFData message to the target asynchronously, forcing evaluation (i.e., deepseq) beforehand.

unresolvableMessage :: a -> String Source

Unresolvable Addressable Message

class (Resolvable a, Routable a) => Addressable a Source

Instances

data RegisterSelf Source

Used internally in whereisOrStart. Sent as (RegisterSelf,ProcessId).

Constructors

RegisterSelf 

Interactions

whereisRemote :: NodeId -> String -> Process (Maybe ProcessId) Source

A synchronous version of whereis, this relies on call to perform the relevant monitoring of the remote node.

resolveOrDie :: (Routable a, 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.

data Shutdown Source

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 Shutdown

ExitOther !String

abnormal (error) shutdown

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