| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Raft.RPC
Synopsis
- class RaftSendRPC m v where
- sendRPC :: NodeId -> RPCMessage v -> m ()
- class Show (RaftRecvRPCError m v) => RaftRecvRPC m v where
- type RaftRecvRPCError m v
- receiveRPC :: m (Either (RaftRecvRPCError m v) (RPCMessage v))
- data RPCMessage v = RPCMessage {}
- data RPC v
- class RPCType a v where
- rpcTerm :: RPC v -> Term
- data NoEntriesSpec
- data EntriesSpec v
- = FromIndex Index
- | FromNewLeader (Entry v)
- | FromClientWriteReq (Entry v)
- | NoEntries NoEntriesSpec
- data AppendEntriesData v = AppendEntriesData {
- aedTerm :: Term
- aedLeaderCommit :: Index
- aedEntriesSpec :: EntriesSpec v
- data AppendEntries v = AppendEntries {
- aeTerm :: Term
- aeLeaderId :: LeaderId
- aePrevLogIndex :: Index
- aePrevLogTerm :: Term
- aeEntries :: Entries v
- aeLeaderCommit :: Index
- aeReadRequest :: Maybe Int
- data AppendEntriesResponse = AppendEntriesResponse {
- aerTerm :: Term
- aerSuccess :: Bool
- aerReadRequest :: Maybe Int
- data RequestVote = RequestVote {}
- data RequestVoteResponse = RequestVoteResponse {
- rvrTerm :: Term
- rvrVoteGranted :: Bool
Documentation
class RaftSendRPC m v where #
Interface for nodes to send messages to one another. E.g. Control.Concurrent.Chan, Network.Socket, etc.
Methods
sendRPC :: NodeId -> RPCMessage v -> m () #
Instances
| (MonadIO m, MonadConc m, Serialize v, Show v) => RaftSendRPC (RaftSocketT v m) v # | |
Defined in Examples.Raft.Socket.Node Methods sendRPC :: NodeId -> RPCMessage v -> RaftSocketT v m () # | |
class Show (RaftRecvRPCError m v) => RaftRecvRPC m v where #
Interface for nodes to receive messages from one another
Associated Types
type RaftRecvRPCError m v #
Methods
receiveRPC :: m (Either (RaftRecvRPCError m v) (RPCMessage v)) #
Instances
| (MonadIO m, MonadConc m, Show v) => RaftRecvRPC (RaftSocketT v m) v # | |
Defined in Examples.Raft.Socket.Node Associated Types type RaftRecvRPCError (RaftSocketT v m) v :: Type # Methods receiveRPC :: RaftSocketT v m (Either (RaftRecvRPCError (RaftSocketT v m) v) (RPCMessage v)) # | |
data RPCMessage v #
Representation of a message sent between nodes
Constructors
| RPCMessage | |
Instances
| Show v => Show (RPCMessage v) # | |
Defined in Raft.RPC Methods showsPrec :: Int -> RPCMessage v -> ShowS # show :: RPCMessage v -> String # showList :: [RPCMessage v] -> ShowS # | |
| Generic (RPCMessage v) # | |
| Serialize v => Serialize (RPCMessage v) # | |
Defined in Raft.RPC | |
| type Rep (RPCMessage v) # | |
Defined in Raft.RPC type Rep (RPCMessage v) = D1 (MetaData "RPCMessage" "Raft.RPC" "libraft-0.1.1.0-K88ErXXABXGJHe9OF75EJD" False) (C1 (MetaCons "RPCMessage" PrefixI True) (S1 (MetaSel (Just "sender") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 NodeId) :*: S1 (MetaSel (Just "rpc") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (RPC v)))) | |
Constructors
| AppendEntriesRPC (AppendEntries v) | |
| AppendEntriesResponseRPC AppendEntriesResponse | |
| RequestVoteRPC RequestVote | |
| RequestVoteResponseRPC RequestVoteResponse |
Instances
| Show v => Show (RPC v) # | |
| Generic (RPC v) # | |
| Serialize v => Serialize (RPC v) # | |
| type Rep (RPC v) # | |
Defined in Raft.RPC type Rep (RPC v) = D1 (MetaData "RPC" "Raft.RPC" "libraft-0.1.1.0-K88ErXXABXGJHe9OF75EJD" False) ((C1 (MetaCons "AppendEntriesRPC" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (AppendEntries v))) :+: C1 (MetaCons "AppendEntriesResponseRPC" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 AppendEntriesResponse))) :+: (C1 (MetaCons "RequestVoteRPC" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 RequestVote)) :+: C1 (MetaCons "RequestVoteResponseRPC" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 RequestVoteResponse)))) | |
Instances
| RPCType RequestVoteResponse v # | |
Defined in Raft.RPC Methods toRPC :: RequestVoteResponse -> RPC v # | |
| RPCType RequestVote v # | |
Defined in Raft.RPC Methods toRPC :: RequestVote -> RPC v # | |
| RPCType AppendEntriesResponse v # | |
Defined in Raft.RPC Methods toRPC :: AppendEntriesResponse -> RPC v # | |
| RPCType (AppendEntries v) v # | |
Defined in Raft.RPC Methods toRPC :: AppendEntries v -> RPC v # | |
data NoEntriesSpec #
Constructors
| FromInconsistency | |
| FromHeartbeat | |
| FromClientReadReq Int |
Instances
| Show NoEntriesSpec # | |
Defined in Raft.RPC Methods showsPrec :: Int -> NoEntriesSpec -> ShowS # show :: NoEntriesSpec -> String # showList :: [NoEntriesSpec] -> ShowS # | |
data EntriesSpec v #
Constructors
| FromIndex Index | |
| FromNewLeader (Entry v) | |
| FromClientWriteReq (Entry v) | |
| NoEntries NoEntriesSpec |
Instances
| Show v => Show (EntriesSpec v) # | |
Defined in Raft.RPC Methods showsPrec :: Int -> EntriesSpec v -> ShowS # show :: EntriesSpec v -> String # showList :: [EntriesSpec v] -> ShowS # | |
data AppendEntriesData v #
The data used to construct an AppendEntries value, snapshotted from the node state at the time the AppendEntries val should be created.
Constructors
| AppendEntriesData | |
Fields
| |
Instances
| Show v => Show (AppendEntriesData v) # | |
Defined in Raft.RPC Methods showsPrec :: Int -> AppendEntriesData v -> ShowS # show :: AppendEntriesData v -> String # showList :: [AppendEntriesData v] -> ShowS # | |
data AppendEntries v #
Representation of a message sent from a leader to its peers
Constructors
| AppendEntries | |
Fields
| |
Instances
data AppendEntriesResponse #
Representation of the response from a follower to an AppendEntries message
Constructors
| AppendEntriesResponse | |
Fields
| |
Instances
data RequestVote #
Representation of the message sent by candidates to their peers to request their vote
Constructors
| RequestVote | |
Fields
| |
Instances
| Show RequestVote # | |
Defined in Raft.RPC Methods showsPrec :: Int -> RequestVote -> ShowS # show :: RequestVote -> String # showList :: [RequestVote] -> ShowS # | |
| Generic RequestVote # | |
| Serialize RequestVote # | |
Defined in Raft.RPC | |
| RPCType RequestVote v # | |
Defined in Raft.RPC Methods toRPC :: RequestVote -> RPC v # | |
| type Rep RequestVote # | |
Defined in Raft.RPC type Rep RequestVote = D1 (MetaData "RequestVote" "Raft.RPC" "libraft-0.1.1.0-K88ErXXABXGJHe9OF75EJD" False) (C1 (MetaCons "RequestVote" PrefixI True) ((S1 (MetaSel (Just "rvTerm") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Term) :*: S1 (MetaSel (Just "rvCandidateId") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 NodeId)) :*: (S1 (MetaSel (Just "rvLastLogIndex") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Index) :*: S1 (MetaSel (Just "rvLastLogTerm") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Term)))) | |
data RequestVoteResponse #
Representation of a response to a RequestVote message
Constructors
| RequestVoteResponse | |
Fields
| |