Beispiel #1
0
func (this *Paxos) doRestoreConfig(config *thispb.Configuration) {
	this.learnerList = config.GetLearnerList()
	this.proposerList = config.GetProposerList()
	this.acceptorList = config.GetAcceptorList()

	if config.IsLearner != nil && config.GetIsLearner() {
		atomic.StoreInt32(&this.isLearner, 1)
	}
	if config.IsAcceptor != nil && config.GetIsAcceptor() {
		atomic.StoreInt32(&this.isAcceptor, 1)
	}
	if config.IsProposer != nil && config.GetIsProposer() {
		atomic.StoreInt32(&this.isProposer, 1)
		this.proposerIndex = int(config.GetProposerIndex())
	}
	if config.MajoritySize != nil {
		atomic.StoreInt32(&this.majoritySize, config.GetMajoritySize())
	}
}