mirror of
https://github.com/status-im/nim-raft.git
synced 2025-01-27 05:14:45 +00:00
fix
This commit is contained in:
parent
3b3e9b2765
commit
987f4efd99
@ -14,7 +14,7 @@ import chronicles
|
||||
|
||||
type
|
||||
# Node events
|
||||
EventType = enum
|
||||
EventType* = enum
|
||||
VotingTimeout,
|
||||
ElectionTimeout,
|
||||
HeartbeatTimeout,
|
||||
@ -59,7 +59,7 @@ type
|
||||
|
||||
# FSM type constructor
|
||||
proc new*[RaftNodeState, EventType, NodeType, RaftNodeStates](
|
||||
T: type ConsensusFsm[RaftNodeState, EventType, NodeType, RaftMessageBase], startSymbol: RaftNodeState): T =
|
||||
T: type ConsensusFsm[RaftNodeState, EventType, NodeType, RaftMessageBase], startSymbol: RaftNodeState = rnsFollower): T =
|
||||
|
||||
result = new(ConsensusFsm[NodeType, EventType, RaftNodeStates])
|
||||
initRLock(result.mtx)
|
||||
@ -79,7 +79,7 @@ proc addFsmTransitionLogicalConditions*[RaftNodeState, EventType, NodeType, Raft
|
||||
fsm: ConsensusFsm[RaftNodeState, EventType, NodeType, RaftMessageBase],
|
||||
state: RaftNodeState,
|
||||
event: EventType,
|
||||
logicalConditions: seq[LogicalCondition[NodeType, Option[RaftMessageBase]]]) =
|
||||
logicalConditions: seq[LogicalCondition[NodeType, RaftMessageBase]]) =
|
||||
|
||||
fsm.logicalFunctionsLut[(state, event)] = logicalConditions
|
||||
|
||||
|
@ -8,10 +8,12 @@
|
||||
# those terms.
|
||||
|
||||
import unittest2
|
||||
import basic_state_machine
|
||||
import ../raft/consensus_state_machine
|
||||
import ../raft/types
|
||||
|
||||
suite "Create and test Consensus State Machine":
|
||||
|
||||
test "Create Consensus State Machine":
|
||||
let csm = ConsensusStateMachine.new()
|
||||
let csm = ConsensusFsm[RaftNodeState, EventType, RaftNode[SmState, SmCommand], RaftMessageBase].new()
|
||||
check csm != nil
|
Loading…
x
Reference in New Issue
Block a user