paxos

package
v0.0.0-...-7ef8827 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2016 License: AGPL-3.0, AGPL-3.0-only Imports: 15 Imported by: 0

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 *eng.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 *common.TxnId) []byte

func NewBadReads

func NewBadReads() badReads

func NewProposal

func NewProposal(pm *ProposerManager, txn *eng.TxnReader, fInc 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, sendToAll bool, instances *msgs.InstancesForVar_List, am *AcceptorManager) *Acceptor

func NewAcceptor

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

func (*Acceptor) BallotAccepted

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

func (*Acceptor) ConnectedRMs

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

func (*Acceptor) ConnectionEstablished

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

func (*Acceptor) ConnectionLost

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

func (*Acceptor) Start

func (a *Acceptor) Start()

func (*Acceptor) Status

func (a *Acceptor) Status(sc *server.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(sender common.RMId)

type AcceptorDispatcher

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

func NewAcceptorDispatcher

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

func (*AcceptorDispatcher) OneATxnVotesReceived

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

func (*AcceptorDispatcher) Status

func (ad *AcceptorDispatcher) Status(sc *server.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 {
	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, db *db.Databases) *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) Status

func (am *AcceptorManager) Status(sc *server.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 *eng.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 BallotAccumulator

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

func BallotAccumulatorFromData

func BallotAccumulatorFromData(txn *eng.TxnReader, outcome *outcomeEqualId, instances *msgs.InstancesForVar_List) *BallotAccumulator

func NewBallotAccumulator

func NewBallotAccumulator(txn *eng.TxnReader) *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 *eng.TxnReader) *outcomeEqualId

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 *server.StatusConsumer)

type Blocking

type Blocking bool
const (
	Async Blocking = false
	Sync  Blocking = true
)

type ClientConnection

type ClientConnection interface {
	Shutdownable
	ServerConnectionSubscriber
	SubmissionOutcomeReceived(common.RMId, *eng.TxnReader, *msgs.Outcome)
}

type Connection

type Connection interface {
	Host() string
	RMId() common.RMId
	BootCount() uint32
	TieBreak() uint32
	ClusterUUId() uint64
	Send(msg []byte)
}

type ConnectionManager

type ConnectionManager interface {
	ServerConnectionPublisher
	eng.TopologyPublisher
	ClientEstablished(connNumber uint32, conn ClientConnection) map[common.RMId]Connection
	ClientLost(connNumber uint32, conn ClientConnection)
	GetClient(bootNumber, connNumber uint32) ClientConnection
	BootCount() uint32
}

type Dispatchers

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

func NewDispatchers

func NewDispatchers(cm ConnectionManager, rmId common.RMId, count uint8, db *db.Databases, lc eng.LocalConnection) *Dispatchers

func (*Dispatchers) IsDatabaseEmpty

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

type OneShotSender

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

func NewOneShotSender

func NewOneShotSender(msg []byte, connPub ServerConnectionPublisher, recipients ...common.RMId) *OneShotSender

func (*OneShotSender) ConnectedRMs

func (s *OneShotSender) ConnectedRMs(conns map[common.RMId]Connection)

func (*OneShotSender) ConnectionEstablished

func (s *OneShotSender) ConnectionEstablished(rmId common.RMId, conn Connection, conns map[common.RMId]Connection, done func())

func (*OneShotSender) ConnectionLost

func (s *OneShotSender) ConnectionLost(common.RMId, map[common.RMId]Connection)

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(fInc int, acceptors common.RMIds) *OutcomeAccumulator

func (*OutcomeAccumulator) BallotOutcomeReceived

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

func (*OutcomeAccumulator) IsAllAborts

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

func (*OutcomeAccumulator) Status

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

func (*OutcomeAccumulator) TopologyChange

func (oa *OutcomeAccumulator) TopologyChange(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 *eng.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()

func (*Proposer) BallotOutcomeReceived

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

func (*Proposer) ConnectedRMs

func (pab *Proposer) ConnectedRMs(conns map[common.RMId]Connection)

func (*Proposer) ConnectionEstablished

func (pab *Proposer) ConnectionEstablished(rmId common.RMId, conn Connection, conns map[common.RMId]Connection, done func())

func (*Proposer) ConnectionLost

func (pab *Proposer) ConnectionLost(rmId common.RMId, conns map[common.RMId]Connection)

func (*Proposer) Start

func (p *Proposer) Start()

func (*Proposer) Status

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

func (*Proposer) TopologyChange

func (p *Proposer) TopologyChange(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, cm ConnectionManager, db *db.Databases, varDispatcher *eng.VarDispatcher) *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) Status

func (pd *ProposerDispatcher) Status(sc *server.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 *eng.TxnReader)

func (*ProposerDispatcher) TxnSubmissionAbortReceived

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

type ProposerManager

type ProposerManager struct {
	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, cm ConnectionManager, db *db.Databases, varDispatcher *eng.VarDispatcher) *ProposerManager

func (*ProposerManager) AddToPaxosProposals

func (pm *ProposerManager) AddToPaxosProposals(txnId *common.TxnId, ballots []*eng.Ballot, rmId common.RMId)

func (*ProposerManager) FinishProposers

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

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

func (*ProposerManager) ImmigrationReceived

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

func (*ProposerManager) NewPaxosProposals

func (pm *ProposerManager) NewPaxosProposals(txn *eng.TxnReader, fInc 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) Status

func (pm *ProposerManager) Status(sc *server.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 *eng.TxnReader, twoBTxnVotes *msgs.TwoBTxnVotes)

from network

func (*ProposerManager) TxnFinished

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

from proposer

func (*ProposerManager) TxnGloballyCompleteReceived

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

from network

func (*ProposerManager) TxnReceived

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

func (*ProposerManager) TxnSubmissionAbortReceived

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

from network

type ProposerMode

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

type RepeatingAllSender

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

func NewRepeatingAllSender

func NewRepeatingAllSender(msg []byte) *RepeatingAllSender

func (*RepeatingAllSender) ConnectedRMs

func (s *RepeatingAllSender) ConnectedRMs(conns map[common.RMId]Connection)

func (*RepeatingAllSender) ConnectionEstablished

func (s *RepeatingAllSender) ConnectionEstablished(rmId common.RMId, conn Connection, conns map[common.RMId]Connection, done func())

func (*RepeatingAllSender) ConnectionLost

func (s *RepeatingAllSender) ConnectionLost(common.RMId, map[common.RMId]Connection)

type RepeatingSender

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

func NewRepeatingSender

func NewRepeatingSender(msg []byte, recipients ...common.RMId) *RepeatingSender

func (*RepeatingSender) ConnectedRMs

func (s *RepeatingSender) ConnectedRMs(conns map[common.RMId]Connection)

func (*RepeatingSender) ConnectionEstablished

func (s *RepeatingSender) ConnectionEstablished(rmId common.RMId, conn Connection, conns map[common.RMId]Connection, done func())

func (*RepeatingSender) ConnectionLost

func (s *RepeatingSender) ConnectionLost(common.RMId, map[common.RMId]Connection)

type ServerConnectionPublisher

type ServerConnectionPublisher interface {
	AddServerConnectionSubscriber(obs ServerConnectionSubscriber)
	RemoveServerConnectionSubscriber(obs ServerConnectionSubscriber)
}

type ServerConnectionSubscriber

type ServerConnectionSubscriber interface {
	ConnectedRMs(map[common.RMId]Connection)
	ConnectionLost(common.RMId, map[common.RMId]Connection)
	ConnectionEstablished(common.RMId, Connection, map[common.RMId]Connection, func())
}

type Shutdownable

type Shutdownable interface {
	Shutdown(sync Blocking)
}

Jump to

Keyboard shortcuts

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