raft: add/remove -> addNode/removeNode

release-2.0
Blake Mizerany 2014-06-13 16:08:59 -07:00 committed by Yicheng Qin
parent e5b9e22518
commit 15a8b46359
2 changed files with 4 additions and 4 deletions

View File

@ -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")
}

View File

@ -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
}