- 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
- data Cause
- = Join {
- joining :: !PrivateGroup
- | Leave {
- leaving :: !PrivateGroup
- | Disconnect { }
- | Network {
- sets :: ![[PrivateGroup]]
- localSet :: ![PrivateGroup]
- = Join {
- groupName :: Group -> ByteString
- mkPrivateGroup :: ByteString -> Group
- privateName :: PrivateName -> ByteString
- data GroupMsg
- data MembershipMsg
- = Transient {
- changingGroup :: !Group
- | Reg {
- changingGroup :: !Group
- index :: !Int
- numMembers :: !Int
- members :: ![PrivateGroup]
- groupId :: !GroupId
- cause :: !Cause
- | SelfLeave {
- changingGroup :: !Group
- = Transient {
- receive_internal :: Handle -> PrivateGroup -> IO Message
- multicast_internal :: Sendable a => PrivateGroup -> a -> Handle -> IO Bool
- mkGroup :: ByteString -> Maybe Group
- mkPrivateName :: ByteString -> PrivateName
- putPadded :: Int -> ByteString -> PutM ()
- makeGroup :: String -> Maybe Group
- data KillMsg = Kill PrivateGroup
- data RejectedMsg
- 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
Message to be sent.
Outgoing | |
|
Message received.
Incoming | |
|
Union Type of messages that can be received from the server.
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.
data OrderingType Source
Represents the orderings as specified by the Spread toolkit.
What caused a membership message.
Join | |
| |
Leave | |
| |
Disconnect | |
Network | |
|
groupName :: Group -> ByteStringSource
Messages used to join or leave a group.
data MembershipMsg Source
Message regarding changes in group membership.
Transient | |
| |
Reg | |
| |
SelfLeave | |
|
receive_internal :: Handle -> PrivateGroup -> IO MessageSource
multicast_internal :: Sendable a => PrivateGroup -> a -> Handle -> IO BoolSource
mkGroup :: ByteString -> Maybe GroupSource
data Connection Source
Abstract type representing a connection with a spread server.
privateGroup :: Connection -> PrivateGroupSource
private name of this connection, useful for p2p messages.
Configuration passed to connect
Conf | |
|
defaulConf = Conf Nothing Nothing (mkPrivateName (B.pack "user")) False True []
mkAuthName :: ByteString -> AuthNameSource
The ByteString
will be truncated to the maximum allowed size.
authname :: AuthName -> ByteStringSource
type AuthMethod = (AuthName, Handle -> IO Bool)Source
The action should return True if the authentication succeded.
connect :: Conf -> IO (Chan R Message, Connection)Source
Connects to the specified server, will use a "NULL" authentication method if the authMethods
list is empty.
A spread server will refuse the connection if another with the same PrivateName is still active.
disconnect :: Connection -> IO ()Source
Sends a disconnection message to the server, which will close the connection.
startReceive :: Connection -> IO BoolSource
Start fetching messages from the network, returns True if it was stopped.
stopReceive :: Connection -> IO BoolSource
Stop fetching messages from the network (at most one more message can be read) , returns True if it was started.
getDupedChan :: Connection -> IO (Chan R Message)Source
Messages received from now on will be available on the returned Chan