Safe Haskell | None |
---|---|
Language | Haskell2010 |
Control.Distributed.Process.Extras.Internal.Types
Contents
Description
Types used throughout the Extras package
Synopsis
- type Tag = Int
- type TagPool = MVar Tag
- newTagPool :: Process TagPool
- getTag :: TagPool -> Process Tag
- class Linkable a where
- class Killable p where
- killProc :: p -> String -> Process ()
- exitProc :: (Resolvable p, Serializable m) => p -> m -> Process ()
- class Resolvable a where
- class Routable a where
- sendTo :: (Serializable m, Resolvable a) => a -> m -> Process ()
- unsafeSendTo :: (NFSerializable m, Resolvable a) => a -> m -> Process ()
- class Monitored a r m | a r -> m where
- mkMonitor :: a -> Process r
- checkMonitor :: a -> r -> m -> Process Bool
- class (Resolvable a, Routable a) => Addressable a
- data Recipient
- = Pid !ProcessId
- | Registered !String
- | RemoteRegistered !String !NodeId
- data RegisterSelf = RegisterSelf
- whereisRemote :: NodeId -> String -> Process (Maybe ProcessId)
- resolveOrDie :: Resolvable a => a -> String -> Process ProcessId
- data CancelWait = CancelWait
- type Channel a = (SendPort a, ReceivePort a)
- data Shutdown = Shutdown
- data ExitReason
- newtype ServerDisconnected = ServerDisconnected DiedReason
- class (NFData a, Serializable a) => NFSerializable a
Tagging
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.
Addressing
class Linkable a where Source #
Class of things to which a Process
can link itself.
Minimal complete definition
Nothing
class Killable p where Source #
Class of things that can be killed (or instructed to exit).
Minimal complete definition
Nothing
Methods
killProc :: p -> String -> Process () Source #
Kill (instruct to exit) generic process, using kill
primitive.
exitProc :: (Resolvable p, Serializable m) => p -> m -> Process () Source #
Kill (instruct to exit) generic process, using exit
primitive.
Instances
Resolvable p => Killable p Source # | |
class Resolvable a where Source #
Class of things that can be resolved to a ProcessId
.
Minimal complete definition
Methods
resolve :: a -> Process (Maybe ProcessId) Source #
Resolve the reference to a process id, or Nothing
if resolution fails
unresolvableMessage :: a -> String Source #
Unresolvable Addressable
Message
Instances
class Routable a where Source #
Class of things that you can route/send serializable message to
Minimal complete definition
Nothing
Methods
sendTo :: (Serializable m, Resolvable a) => a -> m -> Process () Source #
Send a message to the target asynchronously
unsafeSendTo :: (NFSerializable m, Resolvable a) => a -> m -> Process () Source #
Send some NFData
message to the target asynchronously,
forcing evaluation (i.e., deepseq
) beforehand.
Instances
class Monitored a r m | a r -> m where Source #
Instances
Resolvable a => Monitored a MonitorRef ProcessMonitorNotification Source # | |
Defined in Control.Distributed.Process.Extras.Internal.Types Methods mkMonitor :: a -> Process MonitorRef Source # checkMonitor :: a -> MonitorRef -> ProcessMonitorNotification -> Process Bool Source # |
class (Resolvable a, Routable a) => Addressable a Source #
Instances
A simple means of mapping to a receiver.
Constructors
Pid !ProcessId | |
Registered !String | |
RemoteRegistered !String !NodeId |
Instances
data RegisterSelf Source #
Used internally in whereisOrStart. Sent as (RegisterSelf,ProcessId).
Constructors
RegisterSelf |
Instances
Binary RegisterSelf Source # | |||||
NFData RegisterSelf Source # | |||||
Defined in Control.Distributed.Process.Extras.Internal.Types Methods rnf :: RegisterSelf -> () # | |||||
Generic RegisterSelf Source # | |||||
Defined in Control.Distributed.Process.Extras.Internal.Types Associated Types
| |||||
type Rep RegisterSelf Source # | |||||
Interactions
whereisRemote :: NodeId -> String -> Process (Maybe ProcessId) Source #
A synchronous version of whereis
, this monitors the remote node
and returns Nothing
if the node goes down (since a remote node failing
or being non-contactible has the same effect as a process not being
registered from the caller's point of view).
resolveOrDie :: Resolvable a => a -> String -> Process ProcessId Source #
resolve the Resolvable or die with specified msg plus details of what didn't resolve
data CancelWait Source #
Wait cancellation message.
Constructors
CancelWait |
Instances
Binary CancelWait Source # | |||||
NFData CancelWait Source # | |||||
Defined in Control.Distributed.Process.Extras.Internal.Types Methods rnf :: CancelWait -> () # | |||||
Generic CancelWait Source # | |||||
Defined in Control.Distributed.Process.Extras.Internal.Types Associated Types
| |||||
Show CancelWait Source # | |||||
Defined in Control.Distributed.Process.Extras.Internal.Types Methods showsPrec :: Int -> CancelWait -> ShowS # show :: CancelWait -> String # showList :: [CancelWait] -> ShowS # | |||||
Eq CancelWait Source # | |||||
type Rep CancelWait Source # | |||||
type Channel a = (SendPort a, ReceivePort a) Source #
Simple representation of a channel.
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 |
Instances
Binary Shutdown Source # | |
NFData Shutdown Source # | |
Generic Shutdown Source # | |
Defined in Control.Distributed.Process.Extras.Internal.Types | |
Show Shutdown Source # | |
Eq Shutdown Source # | |
type Rep Shutdown Source # | |
data ExitReason Source #
Provides a reason for process termination.
Constructors
ExitNormal | indicates normal exit |
ExitShutdown | normal response to a |
ExitOther !String | abnormal (error) shutdown |
Instances
Binary ExitReason Source # | |||||
NFData ExitReason Source # | |||||
Defined in Control.Distributed.Process.Extras.Internal.Types Methods rnf :: ExitReason -> () # | |||||
Generic ExitReason Source # | |||||
Defined in Control.Distributed.Process.Extras.Internal.Types Associated Types
| |||||
Show ExitReason Source # | |||||
Defined in Control.Distributed.Process.Extras.Internal.Types Methods showsPrec :: Int -> ExitReason -> ShowS # show :: ExitReason -> String # showList :: [ExitReason] -> ShowS # | |||||
Eq ExitReason Source # | |||||
type Rep ExitReason Source # | |||||
Defined in Control.Distributed.Process.Extras.Internal.Types type Rep ExitReason = D1 ('MetaData "ExitReason" "Control.Distributed.Process.Extras.Internal.Types" "distributed-process-extras-0.3.9-7t7MELv3KbhCc2plSNlwpw" 'False) (C1 ('MetaCons "ExitNormal" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "ExitShutdown" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ExitOther" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 String)))) |
newtype ServerDisconnected Source #
Given when a server is unobtainable.
Constructors
ServerDisconnected DiedReason |
Instances
Binary ServerDisconnected Source # | |||||
Defined in Control.Distributed.Process.Extras.Internal.Types Methods put :: ServerDisconnected -> Put # get :: Get ServerDisconnected # putList :: [ServerDisconnected] -> Put # | |||||
NFData ServerDisconnected Source # | |||||
Defined in Control.Distributed.Process.Extras.Internal.Types Methods rnf :: ServerDisconnected -> () # | |||||
Generic ServerDisconnected Source # | |||||
Defined in Control.Distributed.Process.Extras.Internal.Types Associated Types
Methods from :: ServerDisconnected -> Rep ServerDisconnected x # to :: Rep ServerDisconnected x -> ServerDisconnected # | |||||
type Rep ServerDisconnected Source # | |||||
Defined in Control.Distributed.Process.Extras.Internal.Types type Rep ServerDisconnected = D1 ('MetaData "ServerDisconnected" "Control.Distributed.Process.Extras.Internal.Types" "distributed-process-extras-0.3.9-7t7MELv3KbhCc2plSNlwpw" 'True) (C1 ('MetaCons "ServerDisconnected" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 DiedReason))) |
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
(NFData a, Serializable a) => NFSerializable a Source # | |
NFSerializable a => NFSerializable (SendPort a) Source # | |