Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data Mode
- data Transition (init :: Mode) (res :: Mode) where
- StartElection :: Transition Follower Candidate
- HigherTermFoundFollower :: Transition Follower Follower
- RestartElection :: Transition Candidate Candidate
- DiscoverLeader :: Transition Candidate Follower
- HigherTermFoundCandidate :: Transition Candidate Follower
- BecomeLeader :: Transition Candidate Leader
- SendHeartbeat :: Transition Leader Leader
- DiscoverNewLeader :: Transition Leader Follower
- HigherTermFoundLeader :: Transition Leader Follower
- Noop :: Transition init init
- data ResultState init where
- ResultState :: Transition init res -> NodeState res -> ResultState init
- followerResultState :: Transition init Follower -> FollowerState -> ResultState init
- candidateResultState :: Transition init Candidate -> CandidateState -> ResultState init
- leaderResultState :: Transition init Leader -> LeaderState -> ResultState init
- data RaftNodeState where
- RaftNodeState :: {..} -> RaftNodeState
- nodeMode :: RaftNodeState -> Mode
- initRaftNodeState :: RaftNodeState
- data NodeState (a :: Mode) where
- data CurrentLeader
- data FollowerState = FollowerState {}
- data CandidateState = CandidateState {
- csCommitIndex :: Index
- csLastApplied :: Index
- csVotes :: NodeIds
- csLastLogEntryData :: (Index, Term)
- type ClientReadReqs = Map Int (ClientId, Int)
- data LeaderState = LeaderState {}
- setLastLogEntryData :: NodeState ns -> Entries v -> NodeState ns
- getLastLogEntryData :: NodeState ns -> (Index, Term)
- getLastAppliedAndCommitIndex :: NodeState ns -> (Index, Index)
- isFollower :: NodeState s -> Bool
- isCandidate :: NodeState s -> Bool
- isLeader :: NodeState s -> Bool
Documentation
data Transition (init :: Mode) (res :: Mode) where Source #
All valid state transitions of a Raft node
Instances
Show (Transition init res) Source # | |
Defined in Raft.NodeState showsPrec :: Int -> Transition init res -> ShowS # show :: Transition init res -> String # showList :: [Transition init res] -> ShowS # |
data ResultState init where Source #
Existential type hiding the result type of a transition
ResultState :: Transition init res -> NodeState res -> ResultState init |
Instances
Show (ResultState init) Source # | |
Defined in Raft.NodeState showsPrec :: Int -> ResultState init -> ShowS # show :: ResultState init -> String # showList :: [ResultState init] -> ShowS # |
followerResultState :: Transition init Follower -> FollowerState -> ResultState init Source #
candidateResultState :: Transition init Candidate -> CandidateState -> ResultState init Source #
leaderResultState :: Transition init Leader -> LeaderState -> ResultState init Source #
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 # |
nodeMode :: RaftNodeState -> Mode Source #
initRaftNodeState :: RaftNodeState Source #
A node in Raft begins as a follower
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 # |
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
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