示例#1
0
func (vb *varBallot) CalculateResult(br badReads, clock *eng.VectorClock) {
	vb.result = eng.NewBallot(vb.vUUId, eng.Commit, eng.NewVectorClock())
	for _, rmBal := range vb.rmToBallot {
		vb.combineVote(rmBal, br)
	}
	if !vb.result.Aborted() {
		clock.MergeInMax(vb.result.Clock)
	}
}
示例#2
0
func MakeAbortBallots(txn *msgs.Txn, alloc *msgs.Allocation) []*eng.Ballot {
	actions := txn.Actions()
	actionIndices := alloc.ActionIndices()
	ballots := make([]*eng.Ballot, actionIndices.Len())
	for idx, l := 0, actionIndices.Len(); idx < l; idx++ {
		action := actions.At(int(actionIndices.At(idx)))
		vUUId := common.MakeVarUUId(action.VarId())
		ballots[idx] = eng.NewBallot(vUUId, eng.AbortDeadlock, nil)
	}
	return ballots
}