courier-0.1.0.15: A message-passing library for simplifying network applications

Portabilitynon-portable (requires STM)
Stabilityexperimental
Maintainerphil@haphazardhouse.net
Safe HaskellNone

Network.Transport

Description

A Transport abstracts the details of message delivery, and defines the interfaces that specific Transport implementations should provide in order to deliver messages for Endpoints.

The definition of a transport is deliberately low-level in nature. Unless a specific transport describes itself as supporting features like guaranteed delivery, applications should NOT assume that message delivery is reliable.

For example, if a sender sends a message to a name that has not yet been bound, then immediately waits on the response for that message, then the application may hang, as the original message may have been dropped.

However, many application may find it easier to push features such as reliable message delivery into a custom transport, leaving the application only having to concern itself with the messages being delivered rather than how they arrive.

Synopsis

Documentation

type Address = StringSource

A Mailbox is a place where transports can put messages for Endpoints to receive. Typically Endpoints will use the same Mailbox when binding or connecting with a Transport.

An address is a logical identifier suitable for establishing a connection to another Endpoint over a Transport. It's use (if at all) is specific to the Transport in question.

data Binding Source

Bindings are a site for receiving messages on a particular Address through a Transport.

Constructors

Binding 

Fields

bindingName :: Name
 
unbind :: IO ()
 

data Envelope Source

An Envelope is a container for a Message with the Address of the Message's destination.

Instances

type Message = ByteStringSource

Messages are containers for arbitrary data that may be sent to other Endpoints.

type Name = StringSource

Name for uniquely identifying an Endpoint; suitable for identifying the target destination for a Message.

data Resolver Source

A Resolver translates a name into an Address, if possible. Transports may find resolvers useful for determing where to reach a specific Endpoint, given it''s Name.

resolve :: Resolver -> Name -> IO (Maybe Address)Source

Ask the Resolver to find one or more Addresses for the provided Name, if any are available from this resolver.

resolverFromList :: [(Name, Address)] -> ResolverSource

A simple Resolver that accepts an association list of Names to Addresses and returns the addresses associated with a given name in the list.

type Scheme = StringSource

A scheme is an identifier for a discrete type of transport.

data Transport Source

A Transport defines a specific method for establishing connections between Endpoints.

Constructors

Transport 

Fields

scheme :: String
 
handles :: Name -> IO Bool
 
bind :: Mailbox Message -> Name -> IO (Either String Binding)
 
sendTo :: Name -> Message -> IO ()
 
shutdown :: IO ()