Example #1
0
func NewProposer(pm *ProposerManager, txnId *common.TxnId, txnCap *msgs.Txn, mode ProposerMode) *Proposer {
	p := &Proposer{
		proposerManager: pm,
		mode:            mode,
		txnId:           txnId,
		acceptors:       GetAcceptorsFromTxn(txnCap),
		fInc:            int(txnCap.FInc()),
	}
	if mode == ProposerActiveVoter {
		p.txn = eng.TxnFromCap(pm.Exe, pm.VarDispatcher, p, pm.RMId, txnCap)
	}
	p.init()
	return p
}
Example #2
0
func (palc *proposerAwaitLocallyComplete) start() {
	server.Log(palc.txnId, "Outcome for txn determined")
	if palc.txn == nil && palc.outcome.Which() == msgs.OUTCOME_COMMIT {
		// We are a learner (either active or passive), and the result
		// has turned out to be a commit.
		txnCap := palc.outcome.Txn()
		pm := palc.proposerManager
		palc.txn = eng.TxnFromCap(pm.Exe, pm.VarDispatcher, palc.Proposer, pm.RMId, &txnCap)
		palc.txn.Start(false)
	}
	if palc.txn == nil {
		palc.TxnLocallyComplete()
	} else {
		palc.txn.BallotOutcomeReceived(palc.outcome)
	}
}