示例#1
0
文件: paxos.go 项目: bvk/ascent
func (this *Paxos) doGetNextProposalBallot() (int64, error) {
	nextProposalBallot := this.proposalBallot
	if this.proposalBallot < 0 {
		nextProposalBallot = int64(this.proposerIndex)
	} else {
		nextProposalBallot += int64(len(this.proposerList))
	}

	change := thispb.ProposerChange{}
	change.ProposalBallot = proto.Int64(nextProposalBallot)
	if err := this.doUpdateProposer(&change); err != nil {
		this.Errorf("could not update the proposer state: %v", err)
		return -1, err
	}
	return this.proposalBallot, nil
}