paxos

package
v0.0.0-...-53b40aa Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 22, 2018 License: AGPL-3.0, AGPL-3.0-only Imports: 31 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllocForRMId

func AllocForRMId(txn msgs.Txn, rmId common.RMId) *msgs.Allocation

func GetAcceptorsFromTxn

func GetAcceptorsFromTxn(txnCap msgs.Txn) common.RMIds

func MakeAbortBallots

func MakeAbortBallots(txn *txnreader.TxnReader, alloc *msgs.Allocation) []*eng.Ballot

func MakeTxnLocallyCompleteMsg

func MakeTxnLocallyCompleteMsg(txnId *common.TxnId) []byte

func MakeTxnSubmissionAbortMsg

func MakeTxnSubmissionAbortMsg(txnId *common.TxnId) []byte

func MakeTxnSubmissionCompleteMsg

func MakeTxnSubmissionCompleteMsg(txnId, subscriberId *common.TxnId) []byte

func NewBadReads

func NewBadReads() badReads

func NewProposal

func NewProposal(pm *ProposerManager, txn *txnreader.TxnReader, twoFInc int, ballots []*eng.Ballot, instanceRMId common.RMId, acceptors []common.RMId, skipPhase1 bool) *proposal

Types

type Acceptor

type Acceptor struct {
	// contains filtered or unexported fields
}

func AcceptorFromData

func AcceptorFromData(txnId *common.TxnId, outcome *msgs.Outcome, subsCap [][]byte, sendToAll bool, instances *msgs.InstancesForVar_List, am *AcceptorManager) *Acceptor

func NewAcceptor

func NewAcceptor(txn *txnreader.TxnReader, am *AcceptorManager) *Acceptor

func (*Acceptor) BallotAccepted

func (arb *Acceptor) BallotAccepted(instanceRMId common.RMId, inst *instance, vUUId *common.VarUUId, txn *txnreader.TxnReader)

func (*Acceptor) ConnectedRMs

func (arb *Acceptor) ConnectedRMs(conns map[common.RMId]sconn.ServerConnection)

func (*Acceptor) ConnectionEstablished

func (arb *Acceptor) ConnectionEstablished(conn sconn.ServerConnection, conns map[common.RMId]sconn.ServerConnection, done func())

func (*Acceptor) ConnectionLost

func (arb *Acceptor) ConnectionLost(rmId common.RMId, conns map[common.RMId]sconn.ServerConnection)

func (*Acceptor) Log

func (a *Acceptor) Log(keyvals ...interface{}) error

func (*Acceptor) Start

func (a *Acceptor) Start()

func (*Acceptor) Status

func (a *Acceptor) Status(sc *status.StatusConsumer)

func (*Acceptor) TopologyChanged

func (aalc *Acceptor) TopologyChanged(topology *configuration.Topology)

func (*Acceptor) TxnLocallyCompleteReceived

func (aalc *Acceptor) TxnLocallyCompleteReceived(sender common.RMId)

func (*Acceptor) TxnSubmissionCompleteReceived

func (aalc *Acceptor) TxnSubmissionCompleteReceived(subId common.TxnId)

type AcceptorDispatcher

type AcceptorDispatcher struct {
	dispatcher.Dispatcher
	// contains filtered or unexported fields
}

func NewAcceptorDispatcher

func NewAcceptorDispatcher(count uint8, rmId common.RMId, cm connectionmanager.ConnectionManager, db *db.Databases, logger log.Logger) *AcceptorDispatcher

func (*AcceptorDispatcher) OneATxnVotesReceived

func (ad *AcceptorDispatcher) OneATxnVotesReceived(sender common.RMId, oneATxnVotes msgs.OneATxnVotes)

func (*AcceptorDispatcher) SetMetrics

func (ad *AcceptorDispatcher) SetMetrics(metrics *AcceptorMetrics)

func (*AcceptorDispatcher) Status

func (ad *AcceptorDispatcher) Status(sc *status.StatusConsumer)

func (*AcceptorDispatcher) TwoATxnVotesReceived

func (ad *AcceptorDispatcher) TwoATxnVotesReceived(sender common.RMId, twoATxnVotes msgs.TwoATxnVotes)

func (*AcceptorDispatcher) TxnLocallyCompleteReceived

func (ad *AcceptorDispatcher) TxnLocallyCompleteReceived(sender common.RMId, tlc msgs.TxnLocallyComplete)

func (*AcceptorDispatcher) TxnSubmissionCompleteReceived

func (ad *AcceptorDispatcher) TxnSubmissionCompleteReceived(sender common.RMId, tsc msgs.TxnSubmissionComplete)

type AcceptorManager

type AcceptorManager struct {
	sconn.ServerConnectionPublisher

	RMId common.RMId
	DB   *db.Databases
	Exe  *dispatcher.Executor

	Topology *configuration.Topology
	// contains filtered or unexported fields
}

func NewAcceptorManager

func NewAcceptorManager(rmId common.RMId, exe *dispatcher.Executor, cm connectionmanager.ConnectionManager, db *db.Databases, logger log.Logger) *AcceptorManager

func (*AcceptorManager) AcceptorFinished

func (am *AcceptorManager) AcceptorFinished(txnId *common.TxnId)

func (*AcceptorManager) OneATxnVotesReceived

func (am *AcceptorManager) OneATxnVotesReceived(sender common.RMId, txnId *common.TxnId, oneATxnVotes msgs.OneATxnVotes)

func (*AcceptorManager) SetMetrics

func (am *AcceptorManager) SetMetrics(metrics *AcceptorMetrics)

func (*AcceptorManager) Status

func (am *AcceptorManager) Status(sc *status.StatusConsumer)

func (*AcceptorManager) TopologyChanged

func (am *AcceptorManager) TopologyChanged(topology *configuration.Topology, done func(bool))

func (*AcceptorManager) TwoATxnVotesReceived

func (am *AcceptorManager) TwoATxnVotesReceived(sender common.RMId, txn *txnreader.TxnReader, twoATxnVotes msgs.TwoATxnVotes)

func (*AcceptorManager) TxnLocallyCompleteReceived

func (am *AcceptorManager) TxnLocallyCompleteReceived(sender common.RMId, txnId *common.TxnId, tlc msgs.TxnLocallyComplete)

func (*AcceptorManager) TxnSubmissionCompleteReceived

func (am *AcceptorManager) TxnSubmissionCompleteReceived(sender common.RMId, txnId *common.TxnId, tsc msgs.TxnSubmissionComplete)

type AcceptorMetrics

type AcceptorMetrics struct {
	Gauge    prometheus.Gauge
	Lifespan prometheus.Observer
}

type BallotAccumulator

type BallotAccumulator struct {
	// contains filtered or unexported fields
}

func BallotAccumulatorFromData

func BallotAccumulatorFromData(txn *txnreader.TxnReader, outcome *outcomeEqualId, subsCap [][]byte, instances *msgs.InstancesForVar_List, logger log.Logger) *BallotAccumulator

func NewBallotAccumulator

func NewBallotAccumulator(txn *txnreader.TxnReader, logger log.Logger) *BallotAccumulator

func (*BallotAccumulator) AddInstancesToSeg

func (ba *BallotAccumulator) AddInstancesToSeg(seg *capn.Segment) msgs.InstancesForVar_List

func (*BallotAccumulator) BallotReceived

func (ba *BallotAccumulator) BallotReceived(instanceRMId common.RMId, inst *instance, vUUId *common.VarUUId, txn *txnreader.TxnReader) (*outcomeEqualId, common.TxnIds)

For every vUUId involved in this txn, we should see fInc * ballots: one from each RM voting for each vUUId.

func (*BallotAccumulator) Status

func (ba *BallotAccumulator) Status(sc *status.StatusConsumer)

type Dispatchers

type Dispatchers struct {
	AcceptorDispatcher *AcceptorDispatcher
	VarDispatcher      *eng.VarDispatcher
	ProposerDispatcher *ProposerDispatcher
	// contains filtered or unexported fields
}

func NewDispatchers

func NewDispatchers(cm connectionmanager.ConnectionManager, rmId common.RMId, bootCount uint32, count uint8, db *db.Databases, lc localconnection.LocalConnection, logger log.Logger) *Dispatchers

func (*Dispatchers) IsDatabaseEmpty

func (d *Dispatchers) IsDatabaseEmpty() (bool, error)

type OutcomeAccumulator

type OutcomeAccumulator struct {
	// contains filtered or unexported fields
}

OutcomeAccumulator groups together all the different outcomes we've received for a given txn. Once we have at least fInc outcomes from distinct acceptors which all have equal Clocks, we know we have a consensus on the result.

func NewOutcomeAccumulator

func NewOutcomeAccumulator(twoFInc int, acceptors common.RMIds, logger log.Logger) *OutcomeAccumulator

func (*OutcomeAccumulator) BallotOutcomeReceived

func (oa *OutcomeAccumulator) BallotOutcomeReceived(acceptorId common.RMId, outcome *msgs.Outcome) (*msgs.Outcome, bool)

func (*OutcomeAccumulator) IsAllAborts

func (oa *OutcomeAccumulator) IsAllAborts() (acceptors []common.RMId)

func (*OutcomeAccumulator) Status

func (oa *OutcomeAccumulator) Status(sc *status.StatusConsumer)

func (*OutcomeAccumulator) TopologyChanged

func (oa *OutcomeAccumulator) TopologyChanged(topology *configuration.Topology) bool

func (*OutcomeAccumulator) TxnGloballyCompleteReceived

func (oa *OutcomeAccumulator) TxnGloballyCompleteReceived(acceptorId common.RMId) bool

type Proposer

type Proposer struct {
	// contains filtered or unexported fields
}

func NewProposer

func NewProposer(pm *ProposerManager, txn *txnreader.TxnReader, mode ProposerMode, topology *configuration.Topology) *Proposer

func ProposerFromData

func ProposerFromData(pm *ProposerManager, txnId *common.TxnId, data []byte, topology *configuration.Topology) (*Proposer, error)

func (*Proposer) Abort

func (pab *Proposer) Abort() (bool, error)

func (*Proposer) BallotOutcomeReceived

func (pro *Proposer) BallotOutcomeReceived(sender common.RMId, outcome *msgs.Outcome)

func (*Proposer) IsTopologyTxn

func (p *Proposer) IsTopologyTxn() bool

func (*Proposer) Log

func (p *Proposer) Log(keyvals ...interface{}) error

func (*Proposer) Start

func (p *Proposer) Start()

func (*Proposer) Status

func (p *Proposer) Status(sc *status.StatusConsumer)

func (*Proposer) TLCDone

func (p *Proposer) TLCDone() bool

func (*Proposer) TopologyChanged

func (p *Proposer) TopologyChanged(topology *configuration.Topology)

func (*Proposer) TxnBallotsComplete

func (pab *Proposer) TxnBallotsComplete(ballots ...*eng.Ballot)

func (*Proposer) TxnFinished

func (paf *Proposer) TxnFinished(*eng.Txn)

func (*Proposer) TxnGloballyCompleteReceived

func (prgc *Proposer) TxnGloballyCompleteReceived(sender common.RMId)

func (*Proposer) TxnLocallyComplete

func (palc *Proposer) TxnLocallyComplete(*eng.Txn)

type ProposerDispatcher

type ProposerDispatcher struct {
	dispatcher.Dispatcher
	// contains filtered or unexported fields
}

func NewProposerDispatcher

func NewProposerDispatcher(count uint8, rmId common.RMId, bootCount uint32, cm connectionmanager.ConnectionManager, db *db.Databases, varDispatcher *eng.VarDispatcher, logger log.Logger) *ProposerDispatcher

func (*ProposerDispatcher) ImmigrationReceived

func (pd *ProposerDispatcher) ImmigrationReceived(migration msgs.Migration, stateChange eng.TxnLocalStateChange)

func (*ProposerDispatcher) OneBTxnVotesReceived

func (pd *ProposerDispatcher) OneBTxnVotesReceived(sender common.RMId, oneBTxnVotes msgs.OneBTxnVotes)

func (*ProposerDispatcher) SetMetrics

func (pd *ProposerDispatcher) SetMetrics(metrics *ProposerMetrics)

func (*ProposerDispatcher) Status

func (pd *ProposerDispatcher) Status(sc *status.StatusConsumer)

func (*ProposerDispatcher) TwoBTxnVotesReceived

func (pd *ProposerDispatcher) TwoBTxnVotesReceived(sender common.RMId, twoBTxnVotes msgs.TwoBTxnVotes)

func (*ProposerDispatcher) TxnGloballyCompleteReceived

func (pd *ProposerDispatcher) TxnGloballyCompleteReceived(sender common.RMId, tgc msgs.TxnGloballyComplete)

func (*ProposerDispatcher) TxnReceived

func (pd *ProposerDispatcher) TxnReceived(sender common.RMId, txn *txnreader.TxnReader)

func (*ProposerDispatcher) TxnSubmissionAbortReceived

func (pd *ProposerDispatcher) TxnSubmissionAbortReceived(sender common.RMId, tsa msgs.TxnSubmissionAbort)

type ProposerManager

type ProposerManager struct {
	sconn.ServerConnectionPublisher

	RMId          common.RMId
	BootCount     uint32
	VarDispatcher *eng.VarDispatcher
	Exe           *dispatcher.Executor
	DB            *db.Databases
	// contains filtered or unexported fields
}

func NewProposerManager

func NewProposerManager(exe *dispatcher.Executor, rmId common.RMId, bootCount uint32, cm connectionmanager.ConnectionManager, db *db.Databases, varDispatcher *eng.VarDispatcher, logger log.Logger) *ProposerManager

func (*ProposerManager) FinishProposals

func (pm *ProposerManager) FinishProposals(txnId *common.TxnId)

We have an outcome by this point, so we should stop sending proposals.

func (*ProposerManager) ImmigrationReceived

func (pm *ProposerManager) ImmigrationReceived(txn *txnreader.TxnReader, varCaps msgs.Var_List, stateChange eng.TxnLocalStateChange)

func (*ProposerManager) NewPaxosProposals

func (pm *ProposerManager) NewPaxosProposals(txn *txnreader.TxnReader, twoFInc int, ballots []*eng.Ballot, acceptors []common.RMId, rmId common.RMId, skipPhase1 bool)

func (*ProposerManager) OneBTxnVotesReceived

func (pm *ProposerManager) OneBTxnVotesReceived(sender common.RMId, txnId *common.TxnId, oneBTxnVotes msgs.OneBTxnVotes)

from network

func (*ProposerManager) SetMetrics

func (pm *ProposerManager) SetMetrics(metrics *ProposerMetrics)

func (*ProposerManager) Status

func (pm *ProposerManager) Status(sc *status.StatusConsumer)

func (*ProposerManager) TopologyChanged

func (pm *ProposerManager) TopologyChanged(topology *configuration.Topology, done func(bool))

func (*ProposerManager) TwoBTxnVotesReceived

func (pm *ProposerManager) TwoBTxnVotesReceived(sender common.RMId, txnId *common.TxnId, txn *txnreader.TxnReader, twoBTxnVotes msgs.TwoBTxnVotes)

from network

func (*ProposerManager) TxnFinished

func (pm *ProposerManager) TxnFinished(proposer *Proposer)

from proposer

func (*ProposerManager) TxnGloballyCompleteReceived

func (pm *ProposerManager) TxnGloballyCompleteReceived(sender common.RMId, txnId *common.TxnId)

from network

func (*ProposerManager) TxnLocallyComplete

func (pm *ProposerManager) TxnLocallyComplete(p *Proposer)

from proposer, callback

func (*ProposerManager) TxnReceived

func (pm *ProposerManager) TxnReceived(sender common.RMId, txn *txnreader.TxnReader)

func (*ProposerManager) TxnSubmissionAbortReceived

func (pm *ProposerManager) TxnSubmissionAbortReceived(sender common.RMId, txnId *common.TxnId)

from network

type ProposerMetrics

type ProposerMetrics struct {
	Gauge    prometheus.Gauge
	Lifespan prometheus.Observer
}

type ProposerMode

type ProposerMode uint8
const (
	ProposerActiveVoter    ProposerMode = iota
	ProposerActiveLearner  ProposerMode = iota
	ProposerPassiveLearner ProposerMode = iota
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL