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 AppendEntriesSpec v
- = FromIndex Index
- | FromNewLeader (Entry v)
- | FromClientWriteReq (Entry v)
- | NoEntries NoEntriesSpec
- data AppendEntriesData v = AppendEntriesData {}
- 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 Source #
Interface for nodes to send messages to one another. E.g. Control.Concurrent.Chan, Network.Socket, etc.
Methods
sendRPC :: NodeId -> RPCMessage v -> m () Source #
Instances
(Monad m, RaftSendRPC m v) => RaftSendRPC (RaftPostgresT m) v Source # | |
Defined in Raft.Log.PostgreSQL Methods sendRPC :: NodeId -> RPCMessage v -> RaftPostgresT m () Source # | |
(MonadIO m, MonadMask m, RaftSendRPC m v) => RaftSendRPC (RaftPersistFileStoreT m) v Source # | |
Defined in Examples.Raft.FileStore.Persistent Methods sendRPC :: NodeId -> RPCMessage v -> RaftPersistFileStoreT m () Source # | |
(Monad m, RaftSendRPC m v) => RaftSendRPC (RaftLogFileStoreT m) v Source # | |
Defined in Examples.Raft.FileStore.Log Methods sendRPC :: NodeId -> RPCMessage v -> RaftLogFileStoreT m () Source # | |
(MonadCatch m, MonadMask m, MonadIO m, Serialize v, Show v) => RaftSendRPC (RaftSocketT sm v m) v Source # | |
Defined in Examples.Raft.Socket.Node Methods sendRPC :: NodeId -> RPCMessage v -> RaftSocketT sm v m () Source # |
class Show (RaftRecvRPCError m v) => RaftRecvRPC m v where Source #
Interface for nodes to receive messages from one another
Associated Types
type RaftRecvRPCError m v Source #
Methods
receiveRPC :: m (Either (RaftRecvRPCError m v) (RPCMessage v)) Source #
Instances
data RPCMessage v Source #
Representation of a message sent between nodes
Constructors
RPCMessage | |
Instances
Show v => Show (RPCMessage v) Source # | |
Defined in Raft.RPC Methods showsPrec :: Int -> RPCMessage v -> ShowS # show :: RPCMessage v -> String # showList :: [RPCMessage v] -> ShowS # | |
Generic (RPCMessage v) Source # | |
Serialize v => Serialize (RPCMessage v) Source # | |
Defined in Raft.RPC | |
type Rep (RPCMessage v) Source # | |
Defined in Raft.RPC type Rep (RPCMessage v) = D1 (MetaData "RPCMessage" "Raft.RPC" "libraft-0.5.0.0-J9sQlo4v2xjSwCkwompQR" 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) Source # | |
Generic (RPC v) Source # | |
Serialize v => Serialize (RPC v) Source # | |
type Rep (RPC v) Source # | |
Defined in Raft.RPC type Rep (RPC v) = D1 (MetaData "RPC" "Raft.RPC" "libraft-0.5.0.0-J9sQlo4v2xjSwCkwompQR" 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)))) |
class RPCType a v where Source #
Instances
RPCType RequestVoteResponse v Source # | |
RPCType RequestVote v Source # | |
RPCType AppendEntriesResponse v Source # | |
RPCType (AppendEntries v) v Source # | |
data NoEntriesSpec Source #
Constructors
FromHeartbeat | |
FromClientReadReq Int |
Instances
Show NoEntriesSpec Source # | |
Defined in Raft.RPC Methods showsPrec :: Int -> NoEntriesSpec -> ShowS # show :: NoEntriesSpec -> String # showList :: [NoEntriesSpec] -> ShowS # |
data AppendEntriesSpec v Source #
Constructors
FromIndex Index | |
FromNewLeader (Entry v) | |
FromClientWriteReq (Entry v) | |
NoEntries NoEntriesSpec |
Instances
Show v => Show (AppendEntriesSpec v) Source # | |
Defined in Raft.RPC Methods showsPrec :: Int -> AppendEntriesSpec v -> ShowS # show :: AppendEntriesSpec v -> String # showList :: [AppendEntriesSpec v] -> ShowS # |
data AppendEntriesData v Source #
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) Source # | |
Defined in Raft.RPC Methods showsPrec :: Int -> AppendEntriesData v -> ShowS # show :: AppendEntriesData v -> String # showList :: [AppendEntriesData v] -> ShowS # |
data AppendEntries v Source #
Representation of a message sent from a leader to its peers
Constructors
AppendEntries | |
Fields
|
Instances
data AppendEntriesResponse Source #
Representation of the response from a follower to an AppendEntries message
Constructors
AppendEntriesResponse | |
Fields
|
Instances
data RequestVote Source #
Representation of the message sent by candidates to their peers to request their vote
Constructors
RequestVote | |
Fields
|
Instances
Show RequestVote Source # | |
Defined in Raft.RPC Methods showsPrec :: Int -> RequestVote -> ShowS # show :: RequestVote -> String # showList :: [RequestVote] -> ShowS # | |
Generic RequestVote Source # | |
Serialize RequestVote Source # | |
Defined in Raft.RPC | |
RPCType RequestVote v Source # | |
type Rep RequestVote Source # | |
Defined in Raft.RPC type Rep RequestVote = D1 (MetaData "RequestVote" "Raft.RPC" "libraft-0.5.0.0-J9sQlo4v2xjSwCkwompQR" 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 Source #
Representation of a response to a RequestVote message
Constructors
RequestVoteResponse | |
Fields
|
Instances
Show RequestVoteResponse Source # | |
Defined in Raft.RPC Methods showsPrec :: Int -> RequestVoteResponse -> ShowS # show :: RequestVoteResponse -> String # showList :: [RequestVoteResponse] -> ShowS # | |
Generic RequestVoteResponse Source # | |
Defined in Raft.RPC Associated Types type Rep RequestVoteResponse :: Type -> Type # Methods from :: RequestVoteResponse -> Rep RequestVoteResponse x # to :: Rep RequestVoteResponse x -> RequestVoteResponse # | |
Serialize RequestVoteResponse Source # | |
Defined in Raft.RPC | |
RPCType RequestVoteResponse v Source # | |
type Rep RequestVoteResponse Source # | |
Defined in Raft.RPC type Rep RequestVoteResponse = D1 (MetaData "RequestVoteResponse" "Raft.RPC" "libraft-0.5.0.0-J9sQlo4v2xjSwCkwompQR" False) (C1 (MetaCons "RequestVoteResponse" PrefixI True) (S1 (MetaSel (Just "rvrTerm") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Term) :*: S1 (MetaSel (Just "rvrVoteGranted") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Bool))) |