Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- class RaftSendClient m sm where
- sendClient :: ClientId -> ClientResponse sm -> m ()
- class Show (RaftRecvClientError m v) => RaftRecvClient m v where
- type RaftRecvClientError m v
- receiveClient :: m (Either (RaftRecvClientError m v) (ClientRequest v))
- data ClientRequest v = ClientRequest ClientId (ClientReq v)
- data ClientReq v
- data ClientResponse s
- newtype ClientReadResp s = ClientReadResp s
- data ClientWriteResp = ClientWriteResp Index
- data ClientRedirResp = ClientRedirResp CurrentLeader
Documentation
class RaftSendClient m sm where Source #
Interface for Raft nodes to send messages to clients
sendClient :: ClientId -> ClientResponse sm -> m () Source #
Instances
(MonadIO m, MonadConc m, Serialize sm) => RaftSendClient (RaftSocketT v m) sm Source # | |
Defined in Examples.Raft.Socket.Node sendClient :: ClientId -> ClientResponse sm -> RaftSocketT v m () Source # |
class Show (RaftRecvClientError m v) => RaftRecvClient m v where Source #
Interface for Raft nodes to receive messages from clients
type RaftRecvClientError m v Source #
receiveClient :: m (Either (RaftRecvClientError m v) (ClientRequest v)) Source #
Instances
(MonadIO m, MonadConc m, Serialize v) => RaftRecvClient (RaftSocketT v m) v Source # | |
Defined in Examples.Raft.Socket.Node type RaftRecvClientError (RaftSocketT v m) v :: Type Source # receiveClient :: RaftSocketT v m (Either (RaftRecvClientError (RaftSocketT v m) v) (ClientRequest v)) Source # |
data ClientRequest v Source #
Representation of a client request coupled with the client id
Instances
Show v => Show (ClientRequest v) Source # | |
Defined in Raft.Client showsPrec :: Int -> ClientRequest v -> ShowS # show :: ClientRequest v -> String # showList :: [ClientRequest v] -> ShowS # | |
Generic (ClientRequest v) Source # | |
Defined in Raft.Client type Rep (ClientRequest v) :: Type -> Type # from :: ClientRequest v -> Rep (ClientRequest v) x # to :: Rep (ClientRequest v) x -> ClientRequest v # | |
Serialize v => Serialize (ClientRequest v) Source # | |
Defined in Raft.Client put :: Putter (ClientRequest v) # get :: Get (ClientRequest v) # | |
type Rep (ClientRequest v) Source # | |
Defined in Raft.Client type Rep (ClientRequest v) = D1 (MetaData "ClientRequest" "Raft.Client" "libraft-0.1.1.0-8nwazCMBvi7EUIW9UIbZhF" False) (C1 (MetaCons "ClientRequest" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 ClientId) :*: S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (ClientReq v)))) |
Representation of a client request
ClientReadReq | Request the latest state of the state machine |
ClientWriteReq v | Write a command |
Instances
Show v => Show (ClientReq v) Source # | |
Generic (ClientReq v) Source # | |
Serialize v => Serialize (ClientReq v) Source # | |
type Rep (ClientReq v) Source # | |
Defined in Raft.Client type Rep (ClientReq v) = D1 (MetaData "ClientReq" "Raft.Client" "libraft-0.1.1.0-8nwazCMBvi7EUIW9UIbZhF" False) (C1 (MetaCons "ClientReadReq" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "ClientWriteReq" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 v))) |
data ClientResponse s Source #
Representation of a client response
ClientReadResponse (ClientReadResp s) | Respond with the latest state of the state machine. |
ClientWriteResponse ClientWriteResp | Respond with the index of the entry appended to the log |
ClientRedirectResponse ClientRedirResp | Respond with the node id of the current leader |
Instances
newtype ClientReadResp s Source #
Representation of a read response to a client
The s
stands for the "current" state of the state machine
Instances
Show s => Show (ClientReadResp s) Source # | |
Defined in Raft.Client showsPrec :: Int -> ClientReadResp s -> ShowS # show :: ClientReadResp s -> String # showList :: [ClientReadResp s] -> ShowS # | |
Generic (ClientReadResp s) Source # | |
Defined in Raft.Client type Rep (ClientReadResp s) :: Type -> Type # from :: ClientReadResp s -> Rep (ClientReadResp s) x # to :: Rep (ClientReadResp s) x -> ClientReadResp s # | |
Serialize s => Serialize (ClientReadResp s) Source # | |
Defined in Raft.Client put :: Putter (ClientReadResp s) # get :: Get (ClientReadResp s) # | |
type Rep (ClientReadResp s) Source # | |
Defined in Raft.Client type Rep (ClientReadResp s) = D1 (MetaData "ClientReadResp" "Raft.Client" "libraft-0.1.1.0-8nwazCMBvi7EUIW9UIbZhF" True) (C1 (MetaCons "ClientReadResp" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 s))) |
data ClientWriteResp Source #
Representation of a write response to a client
ClientWriteResp Index | Index of the entry appended to the log due to the previous client request |
Instances
Show ClientWriteResp Source # | |
Defined in Raft.Client showsPrec :: Int -> ClientWriteResp -> ShowS # show :: ClientWriteResp -> String # showList :: [ClientWriteResp] -> ShowS # | |
Generic ClientWriteResp Source # | |
Defined in Raft.Client type Rep ClientWriteResp :: Type -> Type # from :: ClientWriteResp -> Rep ClientWriteResp x # to :: Rep ClientWriteResp x -> ClientWriteResp # | |
Serialize ClientWriteResp Source # | |
Defined in Raft.Client put :: Putter ClientWriteResp # get :: Get ClientWriteResp # | |
type Rep ClientWriteResp Source # | |
Defined in Raft.Client type Rep ClientWriteResp = D1 (MetaData "ClientWriteResp" "Raft.Client" "libraft-0.1.1.0-8nwazCMBvi7EUIW9UIbZhF" False) (C1 (MetaCons "ClientWriteResp" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Index))) |
data ClientRedirResp Source #
Representation of a redirect response to a client
Instances
Show ClientRedirResp Source # | |
Defined in Raft.Client showsPrec :: Int -> ClientRedirResp -> ShowS # show :: ClientRedirResp -> String # showList :: [ClientRedirResp] -> ShowS # | |
Generic ClientRedirResp Source # | |
Defined in Raft.Client type Rep ClientRedirResp :: Type -> Type # from :: ClientRedirResp -> Rep ClientRedirResp x # to :: Rep ClientRedirResp x -> ClientRedirResp # | |
Serialize ClientRedirResp Source # | |
Defined in Raft.Client put :: Putter ClientRedirResp # get :: Get ClientRedirResp # | |
type Rep ClientRedirResp Source # | |
Defined in Raft.Client type Rep ClientRedirResp = D1 (MetaData "ClientRedirResp" "Raft.Client" "libraft-0.1.1.0-8nwazCMBvi7EUIW9UIbZhF" False) (C1 (MetaCons "ClientRedirResp" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 CurrentLeader))) |