hspread-0.3: A client library for the spread toolkitSource codeContentsIndex
Spread.Client
Synopsis
data OutMsg = Outgoing {
outOrdering :: !OrderingType
outDiscard :: !Bool
outData :: !ByteString
outGroups :: ![Group]
outMsgType :: !Word16
}
data InMsg = Incoming {
inOrdering :: !OrderingType
inSender :: !PrivateGroup
inData :: !ByteString
inGroups :: ![Group]
inMsgType :: !Word16
inEndianMismatch :: !Bool
}
data Message
= Regular !InMsg
| Membership !MembershipMsg
| Rejected !RejectedMsg
data Group
type PrivateGroup = Group
data PrivateName
data GroupId
data OrderingType
= Unreliable
| Reliable
| Fifo
| Causal
| Agreed
| Safe
data Cause
= Join {
joining :: !PrivateGroup
}
| Leave {
leaving :: !PrivateGroup
}
| Disconnect {
disconnecting :: !PrivateGroup
}
| Network {
sets :: ![[PrivateGroup]]
localSet :: ![PrivateGroup]
}
groupName :: Group -> ByteString
privateName :: PrivateName -> ByteString
data GroupMsg
= Joining {
grp :: !Group
}
| Leaving {
grp :: !Group
}
data MembershipMsg
= Transient {
changingGroup :: !Group
}
| Reg {
changingGroup :: !Group
index :: !Int
numMembers :: !Int
members :: ![PrivateGroup]
groupId :: !GroupId
cause :: !Cause
}
| SelfLeave {
changingGroup :: !Group
}
mkGroup :: ByteString -> Maybe Group
putPadded :: Int -> ByteString -> PutM ()
data KillMsg = Kill PrivateGroup
data RejectedMsg
= WasGroup !GroupMsg
| WasOut !OutMsg
data Connection
privateGroup :: Connection -> PrivateGroup
data Conf = Conf {
address :: !Maybe HostName
port :: !Maybe PortNumber
desiredName :: !PrivateName
priority :: !Bool
groupMembership :: !Bool
authMethods :: ![AuthMethod]
}
defaultConf :: Conf
data AuthName
mkAuthName :: ByteString -> AuthName
authname :: AuthName -> ByteString
type AuthMethod = (AuthName, Handle -> IO Bool)
connect :: Conf -> IO (Chan R Message, Connection)
disconnect :: Connection -> IO ()
startReceive :: Connection -> IO Bool
stopReceive :: Connection -> IO Bool
getDupedChan :: Connection -> IO (Chan R Message)
join :: Group -> Connection -> IO ()
leave :: Group -> Connection -> IO ()
send :: OutMsg -> Connection -> IO ()
Documentation
data OutMsg Source
Message to be sent.
Constructors
Outgoing
outOrdering :: !OrderingType
outDiscard :: !BoolIf True you won't get a copy of this message back from the server.
outData :: !ByteStringMessage body.
outGroups :: ![Group]Recipients of the message
outMsgType :: !Word16To be used by the application to identify the kind of message.
show/hide Instances
data InMsg Source
Message received.
Constructors
Incoming
inOrdering :: !OrderingType
inSender :: !PrivateGroup
inData :: !ByteString
inGroups :: ![Group]
inMsgType :: !Word16
inEndianMismatch :: !BoolTrue if the message has been sent with a different endian order.
show/hide Instances
data Message Source
Union Type of messages that can be received from the server.
Constructors
Regular !InMsg
Membership !MembershipMsg
Rejected !RejectedMsg
show/hide Instances
data Group Source
A Group is a collection of clients identified by a name.
show/hide Instances
type PrivateGroup = GroupSource
A PrivateGroup identifies a connection.
data PrivateName Source
Initial part of a PrivateGroup name that is chosen by the client when connecting.
show/hide Instances
data GroupId Source
Identifier for a membership message.
show/hide Instances
data OrderingType Source
Represents the orderings as specified by the Spread toolkit.
Constructors
Unreliable
Reliable
Fifo
Causal
Agreed
Safe
show/hide Instances
data Cause Source
What caused a membership message.
Constructors
Join
joining :: !PrivateGroup
Leave
leaving :: !PrivateGroup
Disconnect
disconnecting :: !PrivateGroup
Network
sets :: ![[PrivateGroup]]
localSet :: ![PrivateGroup]
show/hide Instances
groupName :: Group -> ByteStringSource
privateName :: PrivateName -> ByteStringSource
data GroupMsg Source
Messages used to join or leave a group.
Constructors
Joining
grp :: !Group
Leaving
grp :: !Group
show/hide Instances
data MembershipMsg Source
Message regarding changes in group membership.
Constructors
Transient
changingGroup :: !Group
Reg
changingGroup :: !Group
index :: !Int
numMembers :: !Int
members :: ![PrivateGroup]
groupId :: !GroupId
cause :: !Cause