예제 #1
0
파일: ballot.go 프로젝트: chang290/server
func BallotFromCap(ballotCap *msgs.Ballot) *Ballot {
	voteCap := ballotCap.Vote()
	ballot := &Ballot{
		VarUUId:   common.MakeVarUUId(ballotCap.VarId()),
		Clock:     VectorClockFromCap(ballotCap.Clock()),
		Vote:      Vote(voteCap.Which()),
		BallotCap: ballotCap,
		VoteCap:   &voteCap,
	}
	return ballot
}
예제 #2
0
파일: proposal.go 프로젝트: chang290/server
func (twoA *proposalTwoA) addTwoAToAcceptRequest(seg *capn.Segment, acceptRequest *msgs.TxnVoteAcceptRequest, sender *proposalSender) bool {
	var ballotPtr *msgs.Ballot
	if twoA.winningBallot == nil { // free choice from everyone
		ballot := twoA.ballot.AddToSeg(seg)
		ballotPtr = &ballot
	} else {
		ballotPtr = twoA.winningBallot
	}
	acceptRequest.SetBallot(*ballotPtr)

	acceptRequest.SetRoundNumber(uint64(twoA.currentRoundNumber))
	twoA.twoASender = sender
	twoA.nextState(nil)
	return ballotPtr.Vote().Which() != msgs.VOTE_COMMIT
}