Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- class RSMP sm v | sm -> v where
- class (Monad m, RSMP sm v) => RSM sm v m | m sm -> v where
- validateCmd :: v -> m (Either (RSMPError sm v) ())
- askRSMPCtx :: m (RSMPCtx sm v)
- 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))
- 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))
- class Monad m => RaftPersist m where
- type RaftPersistError m
- readPersistentState :: Exception (RaftPersistError m) => m (Either (RaftPersistError m) PersistentState)
- writePersistentState :: Exception (RaftPersistError m) => PersistentState -> m (Either (RaftPersistError m) ())
- type EventChan m v = TChan (STM m) (Event v)
- data RaftEnv v m = RaftEnv {
- eventChan :: EventChan m v
- resetElectionTimer :: m ()
- resetHeartbeatTimer :: m ()
- raftNodeConfig :: NodeConfig
- raftNodeLogDest :: LogDest
- runRaftNode :: (Show v, Show sm, Show (Action sm v), MonadIO m, MonadConc m, MonadFail m, RSM sm v m, Show (RSMPError sm v), RaftSendRPC m v, RaftRecvRPC m v, RaftSendClient m sm, RaftRecvClient m v, RaftLog m v, RaftLogExceptions m, RaftPersist m, Exception (RaftPersistError m)) => NodeConfig -> LogDest -> Int -> sm -> m ()
- runRaftT :: MonadConc m => RaftNodeState -> RaftEnv v m -> RaftT v m () -> m ()
- handleEventLoop :: forall sm v m. (Show v, Show sm, Show (Action sm v), MonadIO m, MonadConc m, MonadFail m, RSM sm v m, Show (RSMPError sm v), RaftPersist m, RaftSendRPC m v, RaftSendClient m sm, RaftLog m v, RaftLogExceptions m, RaftPersist m, Exception (RaftPersistError m)) => sm -> RaftT v m ()
- 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
- data NodeConfig = NodeConfig {}
- data Event v
- data Timeout
- data MessageEvent v
- = RPCMessageEvent (RPCMessage v)
- | ClientRequestEvent (ClientRequest v)
- data Entry v = Entry {
- entryIndex :: Index
- entryTerm :: Term
- entryValue :: EntryValue v
- entryIssuer :: EntryIssuer
- type Entries v = Seq (Entry v)
- class Monad m => RaftWriteLog m v where
- type RaftWriteLogError m
- writeLogEntries :: Exception (RaftWriteLogError m) => Entries v -> m (Either (RaftWriteLogError m) ())
- data DeleteSuccess v = DeleteSuccess
- class Monad m => RaftDeleteLog m v where
- type RaftDeleteLogError m
- deleteLogEntriesFrom :: Exception (RaftDeleteLogError m) => Index -> m (Either (RaftDeleteLogError m) (DeleteSuccess v))
- class Monad m => RaftReadLog m v where
- type RaftReadLogError m
- readLogEntry :: Exception (RaftReadLogError m) => Index -> m (Either (RaftReadLogError m) (Maybe (Entry v)))
- readLogEntriesFrom :: Exception (RaftReadLogError m) => Index -> m (Either (RaftReadLogError m) (Entries v))
- readLastLogEntry :: Exception (RaftReadLogError m) => m (Either (RaftReadLogError m) (Maybe (Entry v)))
- type RaftLog m v = (RaftReadLog m v, RaftWriteLog m v, RaftDeleteLog m v)
- data RaftLogError m
- type RaftLogExceptions m = (Exception (RaftReadLogError m), Exception (RaftWriteLogError m), Exception (RaftDeleteLogError m))
- data LogDest
- data Severity
- data Mode
- data RaftNodeState where
- RaftNodeState :: {..} -> RaftNodeState
- data NodeState (a :: Mode) where
- data CurrentLeader
- data FollowerState = FollowerState {}
- data CandidateState = CandidateState {
- csCommitIndex :: Index
- csLastApplied :: Index
- csVotes :: NodeIds
- csLastLogEntryData :: (Index, Term)
- data LeaderState = LeaderState {}
- initRaftNodeState :: RaftNodeState
- isFollower :: NodeState s -> Bool
- isCandidate :: NodeState s -> Bool
- isLeader :: NodeState s -> Bool
- setLastLogEntryData :: NodeState ns -> Entries v -> NodeState ns
- getLastLogEntryData :: NodeState ns -> (Index, Term)
- getLastAppliedAndCommitIndex :: NodeState ns -> (Index, Index)
- data PersistentState = PersistentState {
- currentTerm :: Term
- votedFor :: Maybe NodeId
- initPersistentState :: PersistentState
- type NodeId = ByteString
- type NodeIds = Set NodeId
- newtype ClientId = ClientId NodeId
- newtype LeaderId = LeaderId {
- unLeaderId :: NodeId
- newtype Term = Term Natural
- newtype Index = Index Natural
- term0 :: Term
- index0 :: Index
- data RPC v
- class RPCType a v where
- data RPCMessage v = RPCMessage {}
- 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
- data AppendEntriesData v = AppendEntriesData {
- aedTerm :: Term
- aedLeaderCommit :: Index
- aedEntriesSpec :: EntriesSpec v
State machine type class
class RSMP sm v | sm -> v where Source #
Interface to handle commands in the underlying state machine. Functional dependency permitting only a single state machine command to be defined to update the state machine.
class (Monad m, RSMP sm v) => RSM sm v m | m sm -> v where Source #
validateCmd :: v -> m (Either (RSMPError sm v) ()) Source #
askRSMPCtx :: m (RSMPCtx sm v) Source #
Networking type classes
class RaftSendRPC m v where Source #
Interface for nodes to send messages to one another. E.g. Control.Concurrent.Chan, Network.Socket, etc.
sendRPC :: NodeId -> RPCMessage v -> m () Source #
Instances
(MonadIO m, MonadConc m, Serialize v, Show v) => RaftSendRPC (RaftSocketT v m) v Source # | |
Defined in Examples.Raft.Socket.Node sendRPC :: NodeId -> RPCMessage v -> RaftSocketT v m () Source # |
class Show (RaftRecvRPCError m v) => RaftRecvRPC m v where Source #
Interface for nodes to receive messages from one another
type RaftRecvRPCError m v Source #
receiveRPC :: m (Either (RaftRecvRPCError m v) (RPCMessage v)) Source #
Instances
(MonadIO m, MonadConc m, Show v) => RaftRecvRPC (RaftSocketT v m) v Source # | |
Defined in Examples.Raft.Socket.Node type RaftRecvRPCError (RaftSocketT v m) v :: Type Source # receiveRPC :: RaftSocketT v m (Either (RaftRecvRPCError (RaftSocketT v m) v) (RPCMessage v)) Source # |
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 # |
class Monad m => RaftPersist m where Source #
Provides an interface to read and write the persistent state to disk.
type RaftPersistError m Source #
readPersistentState :: Exception (RaftPersistError m) => m (Either (RaftPersistError m) PersistentState) Source #
writePersistentState :: Exception (RaftPersistError m) => PersistentState -> m (Either (RaftPersistError m) ()) Source #
Instances
(MonadIO m, MonadConc m) => RaftPersist (RaftFileStoreT m) Source # | |
Defined in Examples.Raft.FileStore type RaftPersistError (RaftFileStoreT m) :: Type Source # readPersistentState :: RaftFileStoreT m (Either (RaftPersistError (RaftFileStoreT m)) PersistentState) Source # writePersistentState :: PersistentState -> RaftFileStoreT m (Either (RaftPersistError (RaftFileStoreT m)) ()) Source # |
The raft server environment composed of the concurrent variables used in the effectful raft layer.
RaftEnv | |
|
:: (Show v, Show sm, Show (Action sm v), MonadIO m, MonadConc m, MonadFail m, RSM sm v m, Show (RSMPError sm v), RaftSendRPC m v, RaftRecvRPC m v, RaftSendClient m sm, RaftRecvClient m v, RaftLog m v, RaftLogExceptions m, RaftPersist m, Exception (RaftPersistError m)) | |
=> NodeConfig | Node configuration |
-> LogDest | Logs destination |
-> Int | Timer seed |
-> sm | Initial state machine state |
-> m () |
Run timers, RPC and client request handlers and start event loop. It should run forever
handleEventLoop :: forall sm v m. (Show v, Show sm, Show (Action sm v), MonadIO m, MonadConc m, MonadFail m, RSM sm v m, Show (RSMPError sm v), RaftPersist m, RaftSendRPC m v, RaftSendClient m sm, RaftLog m v, RaftLogExceptions m, RaftPersist m, Exception (RaftPersistError m)) => sm -> RaftT v m () Source #
Client data types
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))) |
Configuration
data NodeConfig Source #
Configuration of a node in the cluster
NodeConfig | |
|
Instances
Show NodeConfig Source # | |
Defined in Raft.Config showsPrec :: Int -> NodeConfig -> ShowS # show :: NodeConfig -> String # showList :: [NodeConfig] -> ShowS # |
Events
Representation of events a raft node can send and receive
Representation of timeouts
ElectionTimeout | Timeout after which a follower will become candidate |
HeartbeatTimeout | Timeout after which a leader will send AppendEntries RPC to all peers |
data MessageEvent v Source #
Representation of message events to a node
RPCMessageEvent (RPCMessage v) | Incoming event from a peer |
ClientRequestEvent (ClientRequest v) | Incoming event from a client |
Instances
Log
Representation of an entry in the replicated log
Entry | |
|
Instances
Show v => Show (Entry v) Source # | |
Generic (Entry v) Source # | |
Serialize v => Serialize (Entry v) Source # | |
type Rep (Entry v) Source # | |
Defined in Raft.Log type Rep (Entry v) = D1 (MetaData "Entry" "Raft.Log" "libraft-0.1.1.0-8nwazCMBvi7EUIW9UIbZhF" False) (C1 (MetaCons "Entry" PrefixI True) ((S1 (MetaSel (Just "entryIndex") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Index) :*: S1 (MetaSel (Just "entryTerm") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Term)) :*: (S1 (MetaSel (Just "entryValue") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (EntryValue v)) :*: S1 (MetaSel (Just "entryIssuer") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 EntryIssuer)))) |
class Monad m => RaftWriteLog m v where Source #
Provides an interface for nodes to write log entries to storage.
type RaftWriteLogError m Source #
writeLogEntries :: Exception (RaftWriteLogError m) => Entries v -> m (Either (RaftWriteLogError m) ()) Source #
Write the given log entries to storage
Instances
(MonadIO m, MonadConc m, Serialize v) => RaftWriteLog (RaftFileStoreT m) v Source # | |
Defined in Examples.Raft.FileStore type RaftWriteLogError (RaftFileStoreT m) :: Type Source # writeLogEntries :: Entries v -> RaftFileStoreT m (Either (RaftWriteLogError (RaftFileStoreT m)) ()) Source # |
data DeleteSuccess v Source #
class Monad m => RaftDeleteLog m v where Source #
Provides an interface for nodes to delete log entries from storage.
type RaftDeleteLogError m Source #
deleteLogEntriesFrom :: Exception (RaftDeleteLogError m) => Index -> m (Either (RaftDeleteLogError m) (DeleteSuccess v)) Source #
Delete log entries from a given index; e.g. 'deleteLogEntriesFrom 7' should delete every log entry with an index >= 7.
Instances
(MonadIO m, MonadConc m, Serialize v) => RaftDeleteLog (RaftFileStoreT m) v Source # | |
Defined in Examples.Raft.FileStore type RaftDeleteLogError (RaftFileStoreT m) :: Type Source # deleteLogEntriesFrom :: Index -> RaftFileStoreT m (Either (RaftDeleteLogError (RaftFileStoreT m)) (DeleteSuccess v)) Source # |
class Monad m => RaftReadLog m v where Source #
Provides an interface for nodes to read log entries from storage.
type RaftReadLogError m Source #
readLogEntry :: Exception (RaftReadLogError m) => Index -> m (Either (RaftReadLogError m) (Maybe (Entry v))) Source #
Read the log at a given index
readLogEntriesFrom :: Exception (RaftReadLogError m) => Index -> m (Either (RaftReadLogError m) (Entries v)) Source #
Read log entries from a specific index onwards, including the specific index
readLastLogEntry :: Exception (RaftReadLogError m) => m (Either (RaftReadLogError m) (Maybe (Entry v))) Source #
Read the last log entry in the log
readLogEntriesFrom :: Exception (RaftReadLogError m) => Index -> m (Either (RaftReadLogError m) (Entries v)) Source #
Read log entries from a specific index onwards, including the specific index
Instances
(MonadIO m, MonadConc m, Serialize v) => RaftReadLog (RaftFileStoreT m) v Source # | |
Defined in Examples.Raft.FileStore type RaftReadLogError (RaftFileStoreT m) :: Type Source # readLogEntry :: Index -> RaftFileStoreT m (Either (RaftReadLogError (RaftFileStoreT m)) (Maybe (Entry v))) Source # readLogEntriesFrom :: Index -> RaftFileStoreT m (Either (RaftReadLogError (RaftFileStoreT m)) (Entries v)) Source # readLastLogEntry :: RaftFileStoreT m (Either (RaftReadLogError (RaftFileStoreT m)) (Maybe (Entry v))) Source # |
type RaftLog m v = (RaftReadLog m v, RaftWriteLog m v, RaftDeleteLog m v) Source #
data RaftLogError m Source #
Representation of possible errors that come from reading, writing or deleting logs from the persistent storage
type RaftLogExceptions m = (Exception (RaftReadLogError m), Exception (RaftWriteLogError m), Exception (RaftDeleteLogError m)) Source #
Logging
Representation of the severity of the logs
Raft node states
data RaftNodeState where Source #
Existential type hiding the internal node state
RaftNodeState | |
|
Instances
Show RaftNodeState Source # | |
Defined in Raft.NodeState showsPrec :: Int -> RaftNodeState -> ShowS # show :: RaftNodeState -> String # showList :: [RaftNodeState] -> ShowS # |
data NodeState (a :: Mode) where Source #
The volatile state of a Raft Node
data CurrentLeader Source #
Representation of the current leader in the cluster. The system is considered to be unavailable if there is no leader
Instances
data FollowerState Source #
FollowerState | |
|
Instances
Show FollowerState Source # | |
Defined in Raft.NodeState showsPrec :: Int -> FollowerState -> ShowS # show :: FollowerState -> String # showList :: [FollowerState] -> ShowS # |
data CandidateState Source #
CandidateState | |
|
Instances
Show CandidateState Source # | |
Defined in Raft.NodeState showsPrec :: Int -> CandidateState -> ShowS # show :: CandidateState -> String # showList :: [CandidateState] -> ShowS # |
data LeaderState Source #
LeaderState | |
|
Instances
Show LeaderState Source # | |
Defined in Raft.NodeState showsPrec :: Int -> LeaderState -> ShowS # show :: LeaderState -> String # showList :: [LeaderState] -> ShowS # |
initRaftNodeState :: RaftNodeState Source #
A node in Raft begins as a follower
isFollower :: NodeState s -> Bool Source #
Check if node is in a follower state
isCandidate :: NodeState s -> Bool Source #
Check if node is in a candidate state
setLastLogEntryData :: NodeState ns -> Entries v -> NodeState ns Source #
Update the last log entry in the node's log
getLastLogEntryData :: NodeState ns -> (Index, Term) Source #
Get the last applied index and the commit index of the last log entry in the node's log
getLastAppliedAndCommitIndex :: NodeState ns -> (Index, Index) Source #
Get the index of highest log entry applied to state machine and the index of highest log entry known to be committed
Persistent state
data PersistentState Source #
Persistent state that all Raft nodes maintain, regardless of node state.
PersistentState | |
|
Instances
initPersistentState :: PersistentState Source #
A node initiates its persistent state with term 0 and with its vote blank
Basic types
type NodeId = ByteString Source #
Unique identifier of a Raft node
Unique identifier of a client
Unique identifier of a leader
Representation of monotonic election terms
Representation of monotonic indices
RPC
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.1.1.0-8nwazCMBvi7EUIW9UIbZhF" 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 RPCMessage v Source #
Representation of a message sent between nodes
Instances
Show v => Show (RPCMessage v) Source # | |
Defined in Raft.RPC showsPrec :: Int -> RPCMessage v -> ShowS # show :: RPCMessage v -> String # showList :: [RPCMessage v] -> ShowS # | |
Generic (RPCMessage v) Source # | |
Defined in Raft.RPC type Rep (RPCMessage v) :: Type -> Type # from :: RPCMessage v -> Rep (RPCMessage v) x # to :: Rep (RPCMessage v) x -> RPCMessage v # | |
Serialize v => Serialize (RPCMessage v) Source # | |
Defined in Raft.RPC put :: Putter (RPCMessage v) # get :: Get (RPCMessage v) # | |
type Rep (RPCMessage v) Source # | |
Defined in Raft.RPC type Rep (RPCMessage v) = D1 (MetaData "RPCMessage" "Raft.RPC" "libraft-0.1.1.0-8nwazCMBvi7EUIW9UIbZhF" 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)))) |
data AppendEntries v Source #
Representation of a message sent from a leader to its peers
AppendEntries | |
|
Instances
data AppendEntriesResponse Source #
Representation of the response from a follower to an AppendEntries message
AppendEntriesResponse | |
|
Instances
Show AppendEntriesResponse Source # | |
Defined in Raft.RPC showsPrec :: Int -> AppendEntriesResponse -> ShowS # show :: AppendEntriesResponse -> String # showList :: [AppendEntriesResponse] -> ShowS # | |
Generic AppendEntriesResponse Source # | |
Serialize AppendEntriesResponse Source # | |
Defined in Raft.RPC | |
RPCType AppendEntriesResponse v Source # | |
type Rep AppendEntriesResponse Source # | |
Defined in Raft.RPC type Rep AppendEntriesResponse = D1 (MetaData "AppendEntriesResponse" "Raft.RPC" "libraft-0.1.1.0-8nwazCMBvi7EUIW9UIbZhF" False) (C1 (MetaCons "AppendEntriesResponse" PrefixI True) (S1 (MetaSel (Just "aerTerm") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Term) :*: (S1 (MetaSel (Just "aerSuccess") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Bool) :*: S1 (MetaSel (Just "aerReadRequest") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe Int))))) |
data RequestVote Source #
Representation of the message sent by candidates to their peers to request their vote
RequestVote | |
|
Instances
data RequestVoteResponse Source #
Representation of a response to a RequestVote message
RequestVoteResponse | |
|
Instances
Show RequestVoteResponse Source # | |
Defined in Raft.RPC showsPrec :: Int -> RequestVoteResponse -> ShowS # show :: RequestVoteResponse -> String # showList :: [RequestVoteResponse] -> ShowS # | |
Generic RequestVoteResponse Source # | |
Defined in Raft.RPC type Rep RequestVoteResponse :: Type -> Type # 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.1.1.0-8nwazCMBvi7EUIW9UIbZhF" False) (C1 (MetaCons "RequestVoteResponse" PrefixI True) (S1 (MetaSel (Just "rvrTerm") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Term) :*: S1 (MetaSel (Just "rvrVoteGranted") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Bool))) |
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.
Instances
Show v => Show (AppendEntriesData v) Source # | |
Defined in Raft.RPC showsPrec :: Int -> AppendEntriesData v -> ShowS # show :: AppendEntriesData v -> String # showList :: [AppendEntriesData v] -> ShowS # |