raft.go
func (r *Raft) setState(state RaftState) {
	r.setLeader("")
	oldState := r.raftState.getState()
	r.raftState.setState(state)
	if oldState != state {
		r.observe(state)
	}
}
func (r *Raft) setState(state RaftState) {
	r.setLeader("")
	oldState := r.raftState.getState()
	r.raftState.setState(state)
	if oldState != state {
		r.observe(state)
	}
}
func ( r * Raft ) setState ( state RaftState ) { r . setLeader ( " " ) oldState := r . raftState . getState ( ) r . raftState . setState ( state ) if oldState != state { r . observe ( state ) } }
// setState is used to update the current state. Any state
// transition causes the known leader to be cleared. This means
// that leader should be set only after updating the state.
setState is used to update the current state . Any state transition causes the known leader to be cleared . This means that leader should be set only after updating the state .