raft: add/remove -> addNode/removeNode
parent
e5b9e22518
commit
15a8b46359
|
@ -93,14 +93,14 @@ func (n *Node) Next() []Entry {
|
|||
golog.Println(err)
|
||||
continue
|
||||
}
|
||||
n.sm.add(c.NodeId)
|
||||
n.sm.addNode(c.NodeId)
|
||||
case configRemove:
|
||||
c := new(config)
|
||||
if err := json.Unmarshal(ents[i].Data, c); err != nil {
|
||||
golog.Println(err)
|
||||
continue
|
||||
}
|
||||
n.sm.remove(c.NodeId)
|
||||
n.sm.removeNode(c.NodeId)
|
||||
default:
|
||||
panic("unexpected entry type")
|
||||
}
|
||||
|
|
|
@ -357,12 +357,12 @@ func (sm *stateMachine) Step(m Message) (ok bool) {
|
|||
return true
|
||||
}
|
||||
|
||||
func (sm *stateMachine) add(id int) {
|
||||
func (sm *stateMachine) addNode(id int) {
|
||||
sm.ins[id] = &index{next: sm.log.lastIndex() + 1}
|
||||
sm.pendingConf = false
|
||||
}
|
||||
|
||||
func (sm *stateMachine) remove(id int) {
|
||||
func (sm *stateMachine) removeNode(id int) {
|
||||
delete(sm.ins, id)
|
||||
sm.pendingConf = false
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue