mirror of
https://github.com/status-im/nim-raft.git
synced 2025-02-04 17:24:49 +00:00
Refactor consensus module scaffold
This commit is contained in:
parent
f95937107a
commit
1f4af32358
@ -10,14 +10,30 @@
|
||||
import protocol
|
||||
import types
|
||||
|
||||
proc RaftNodeConsensusStartElection*(consensus: RaftConsensusModule) =
|
||||
proc RaftNodeStartElection*[SmCommandType, SmStateType](node: RaftNode[SmCommandType, SmStateType]) =
|
||||
discard
|
||||
|
||||
proc RaftNodeConsensusProcessRequestVote*(consensus: RaftConsensusModule, msg: RaftMessageRequestVote): RaftMessageRequestVoteResponse =
|
||||
proc RaftNodeProcessRequestVote*[SmCommandType, SmStateType](node: RaftNode[SmCommandType, SmStateType], msg: RaftMessageRequestVote): RaftMessageRequestVoteResponse =
|
||||
discard
|
||||
|
||||
proc RaftNodeConsensusProcessAppendEntries*(consensus: RaftConsensusModule, msg: RaftMessageAppendEntries): RaftMessageAppendEntriesResponse =
|
||||
proc RaftNodeProcessAppendEntries*[SmCommandType, SmStateType](node: RaftNode[SmCommandType, SmStateType], msg: RaftMessageAppendEntries): RaftMessageAppendEntriesResponse =
|
||||
discard
|
||||
|
||||
proc RaftNodeConsensusQuorumMin(consensus: RaftConsensusModule): bool =
|
||||
proc RaftNodeQuorumMin[SmCommandType, SmStateType](node: RaftNode[SmCommandType, SmStateType]): bool =
|
||||
discard
|
||||
|
||||
proc RaftNodeReplicateSmCommand*[SmCommandType, SmStateType](node: RaftNode[SmCommandType, SmStateType], cmd: SmCommandType) =
|
||||
discard
|
||||
|
||||
# Private Timers Create Ops
|
||||
proc RaftNodeScheduleHeartBeat[SmCommandType, SmStateType](node: RaftNode[SmCommandType, SmStateType]) =
|
||||
discard
|
||||
|
||||
proc RaftNodeScheduleHeartBeatTimeout[SmCommandType, SmStateType](node: RaftNode[SmCommandType, SmStateType]) =
|
||||
discard
|
||||
|
||||
proc RaftNodeScheduleElectionTimeOut[SmCommandType, SmStateType](node: RaftNode[SmCommandType, SmStateType]) =
|
||||
discard
|
||||
|
||||
proc RaftNodeScheduleRequestVoteTimeout[SmCommandType, SmStateType](node: RaftNode[SmCommandType, SmStateType]) =
|
||||
discard
|
@ -7,11 +7,12 @@
|
||||
# This file may not be copied, modified, or distributed except according to
|
||||
# those terms.
|
||||
|
||||
import chronicles
|
||||
import asyncdispatch
|
||||
|
||||
import types
|
||||
import protocol
|
||||
import consensus_module
|
||||
import chronicles
|
||||
import asyncdispatch
|
||||
|
||||
export types, protocol, consensus_module
|
||||
|
||||
@ -111,17 +112,4 @@ proc RaftNodeLogIndexGet[SmCommandType, SmStateType](node: RaftNode[SmCommandTyp
|
||||
discard
|
||||
|
||||
proc RaftNodeLogEntryGet[SmCommandType, SmStateType](node: RaftNode[SmCommandType, SmStateType], logIndex: RaftLogIndex): Result[RaftNodeLogEntry[SmCommandType], string] =
|
||||
discard
|
||||
|
||||
# Private Timers Create Ops
|
||||
proc RaftNodeScheduleHeartBeat[SmCommandType, SmStateType, TimerDurationType](node: RaftNode[SmCommandType, SmStateType]) =
|
||||
discard
|
||||
|
||||
proc RaftNodeScheduleHeartBeatTimeout[SmCommandType, SmStateType, TimerDurationType](node: RaftNode[SmCommandType, SmStateType]) =
|
||||
discard
|
||||
|
||||
proc RaftNodeScheduleElectionTimeOut[SmCommandType, SmStateType, TimerDurationType](node: RaftNode[SmCommandType, SmStateType]) =
|
||||
discard
|
||||
|
||||
proc RaftNodeScheduleRequestVoteTimeout[SmCommandType, SmStateType, TimerDurationType](node: RaftNode[SmCommandType, SmStateType]) =
|
||||
discard
|
||||
discard
|
@ -127,11 +127,6 @@ type
|
||||
# Mtx definition(s) go here
|
||||
raftStateMutex*: Lock
|
||||
|
||||
# Modules (Algos)
|
||||
consensusModule: RaftConsensusModule[SmCommandType, SmStateType]
|
||||
logCompactionModule: RaftLogCompactionModule[SmCommandType, SmStateType]
|
||||
membershipChangeModule: RaftMembershipChangeModule[SmCommandType, SmStateType]
|
||||
|
||||
# Misc
|
||||
msgSendCallback*: RaftMessageSendCallback
|
||||
persistentStorage: RaftNodePersistentStorage[SmCommandType, SmStateType]
|
||||
|
Loading…
x
Reference in New Issue
Block a user