raft.go
func (r *Raft) setLeader(leader ServerAddress) {
	r.leaderLock.Lock()
	oldLeader := r.leader
	r.leader = leader
	r.leaderLock.Unlock()
	if oldLeader != leader {
		r.observe(LeaderObservation{leader: leader})
	}
}
func (r *Raft) setLeader(leader ServerAddress) {
	r.leaderLock.Lock()
	oldLeader := r.leader
	r.leader = leader
	r.leaderLock.Unlock()
	if oldLeader != leader {
		r.observe(LeaderObservation{leader: leader})
	}
}
func ( r * Raft ) setLeader ( leader ServerAddress ) { r . leaderLock . Lock ( ) oldLeader := r . leader r . leader = leader r . leaderLock . Unlock ( ) if oldLeader != leader { r . observe ( LeaderObservation { leader : leader } ) } }
// setLeader is used to modify the current leader of the cluster
setLeader is used to modify the current leader of the cluster