txnengine

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: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Commit        = Vote(msgs.VOTE_COMMIT)
	AbortBadRead  = Vote(msgs.VOTE_ABORTBADREAD)
	AbortDeadlock = Vote(msgs.VOTE_ABORTDEADLOCK)
)
View Source
const (
	VarSubscriber                     TopologyChangeSubscriberType = iota
	ProposerSubscriber                TopologyChangeSubscriberType = iota
	AcceptorSubscriber                TopologyChangeSubscriberType = iota
	ConnectionSubscriber              TopologyChangeSubscriberType = iota
	ConnectionManagerSubscriber       TopologyChangeSubscriberType = iota
	EmigratorSubscriber               TopologyChangeSubscriberType = iota
	TopologyChangeSubscriberTypeLimit int                          = iota
)

Variables

View Source
var AbortRollNotFirst = errors.New("AbortRollNotFirst")
View Source
var AbortRollNotInPermutation = errors.New("AbortRollNotInPermutation")

Functions

func ImmigrationTxnFromCap

func ImmigrationTxnFromCap(exe *dispatcher.Executor, vd *VarDispatcher, stateChange TxnLocalStateChange, ourRMId common.RMId, reader *TxnReader, varCaps *msgs.Var_List)

func NewFrame

func NewFrame(parent *frame, v *Var, txnId *common.TxnId, txnActions *TxnActions, txnClock, writesClock *VectorClockMutable) *frame

Types

type Ballot

type Ballot struct {
	VarUUId *common.VarUUId
	Data    []byte
	VoteCap *msgs.Vote
	Clock   *VectorClock
	Vote    Vote
}

func BallotFromData

func BallotFromData(data []byte) *Ballot

func (*Ballot) Aborted

func (ballot *Ballot) Aborted() bool

func (*Ballot) String

func (b *Ballot) String() string

type BallotBuilder

type BallotBuilder struct {
	*Ballot
	Clock *VectorClockMutable
}

func NewBallotBuilder

func NewBallotBuilder(vUUId *common.VarUUId, vote Vote, clock *VectorClockMutable) *BallotBuilder

func (*BallotBuilder) CreateBadReadBallot

func (ballot *BallotBuilder) CreateBadReadBallot(txnId *common.TxnId, actions *TxnActions) *Ballot

func (*BallotBuilder) ToBallot

func (ballot *BallotBuilder) ToBallot() *Ballot

type LocalConnection

type LocalConnection interface {
	RunClientTransaction(*cmsgs.ClientTxn, map[common.VarUUId]*common.Positions, TranslationCallback) (*TxnReader, *msgs.Outcome, error)
	Status(*server.StatusConsumer)
}

type Poisson

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

func NewPoisson

func NewPoisson() *Poisson

func (*Poisson) AddNow

func (p *Poisson) AddNow()

func (*Poisson) AddThen

func (p *Poisson) AddThen(now time.Time)

func (*Poisson) Cull

func (p *Poisson) Cull(limit time.Time)

func (*Poisson) P

func (p *Poisson) P(t time.Duration, k int64, now time.Time) float64

type TopologyChangeSubscriberType

type TopologyChangeSubscriberType uint8

type TopologyPublisher

type TopologyPublisher interface {
	AddTopologySubscriber(TopologyChangeSubscriberType, TopologySubscriber) *configuration.Topology
	RemoveTopologySubscriberAsync(TopologyChangeSubscriberType, TopologySubscriber)
}

type TopologySubscriber

type TopologySubscriber interface {
	TopologyChanged(*configuration.Topology, func(bool))
}

type TranslationCallback

type TranslationCallback func(*cmsgs.ClientAction, *msgs.Action, []common.RMId, map[common.RMId]bool) error

type Txn

type Txn struct {
	Id    *common.TxnId
	Retry bool

	TxnReader *TxnReader
	// contains filtered or unexported fields
}

func TxnFromReader

func TxnFromReader(exe *dispatcher.Executor, vd *VarDispatcher, stateChange TxnLocalStateChange, ourRMId common.RMId, reader *TxnReader) *Txn

func (*Txn) BallotOutcomeReceived

func (tro *Txn) BallotOutcomeReceived(outcome *msgs.Outcome)

Callback (from network/paxos)

func (*Txn) Compare

func (txnA *Txn) Compare(txnB *Txn) common.Cmp

func (*Txn) CompletionReceived

func (trc *Txn) CompletionReceived()

Callback (from network/paxos)

func (*Txn) LocallyComplete

func (talc *Txn) LocallyComplete()

Callback (from var-dispatcher (frames) back into txn)

func (*Txn) Start

func (txn *Txn) Start(voter bool)

func (*Txn) Status

func (txn *Txn) Status(sc *server.StatusConsumer)

func (*Txn) String

func (txn *Txn) String() string

type TxnActions

type TxnActions struct {
	Data []byte
	// contains filtered or unexported fields
}

func TxnActionsFromData

func TxnActionsFromData(data []byte, forceDecode bool) *TxnActions

func (*TxnActions) Actions

func (actions *TxnActions) Actions() *msgs.Action_List

func (*TxnActions) AsDeflated

func (actions *TxnActions) AsDeflated() *TxnActions

type TxnLocalStateChange

type TxnLocalStateChange interface {
	TxnBallotsComplete(...*Ballot)
	TxnLocallyComplete(*Txn)
	TxnFinished(*Txn)
}

type TxnReader

type TxnReader struct {
	Id *common.TxnId

	Data []byte
	Txn  msgs.Txn
	// contains filtered or unexported fields
}

func TxnReaderFromData

func TxnReaderFromData(data []byte) *TxnReader

func (*TxnReader) Actions

func (tr *TxnReader) Actions(forceDecode bool) *TxnActions

func (*TxnReader) AsDeflated

func (tr *TxnReader) AsDeflated() *TxnReader

func (*TxnReader) Combine

func (a *TxnReader) Combine(b *TxnReader) *TxnReader

func (*TxnReader) IsDeflated

func (tr *TxnReader) IsDeflated() bool

type Var

type Var struct {
	UUId *common.VarUUId
	// contains filtered or unexported fields
}

func NewVar

func NewVar(uuid *common.VarUUId, exe *dispatcher.Executor, db *db.Databases, vm *VarManager) *Var

func VarFromData

func VarFromData(data []byte, exe *dispatcher.Executor, db *db.Databases, vm *VarManager) (*Var, error)

func (*Var) AddWriteSubscriber

func (v *Var) AddWriteSubscriber(txnId *common.TxnId, sub *VarWriteSubscriber)

func (*Var) ReceiveTxn

func (v *Var) ReceiveTxn(action *localAction)

func (*Var) ReceiveTxnOutcome

func (v *Var) ReceiveTxnOutcome(action *localAction)

func (*Var) RemoveWriteSubscriber

func (v *Var) RemoveWriteSubscriber(txnId *common.TxnId)

func (*Var) SetCurFrame

func (v *Var) SetCurFrame(f *frame, action *localAction, positions *common.Positions)

func (*Var) Status

func (v *Var) Status(sc *server.StatusConsumer)

func (*Var) TxnGloballyComplete

func (v *Var) TxnGloballyComplete(action *localAction)

type VarDispatcher

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

func NewVarDispatcher

func NewVarDispatcher(count uint8, rmId common.RMId, cm TopologyPublisher, db *db.Databases, lc LocalConnection) *VarDispatcher

func (*VarDispatcher) ApplyToVar

func (vd *VarDispatcher) ApplyToVar(fun func(*Var), createIfMissing bool, vUUId *common.VarUUId)

func (*VarDispatcher) Status

func (vd *VarDispatcher) Status(sc *server.StatusConsumer)

type VarManager

type VarManager struct {
	LocalConnection
	Topology *configuration.Topology
	RMId     common.RMId

	RollAllowed bool
	// contains filtered or unexported fields
}

func (*VarManager) ApplyToVar

func (vm *VarManager) ApplyToVar(fun func(*Var), createIfMissing bool, uuid *common.VarUUId)

func (*VarManager) ScheduleCallback

func (vm *VarManager) ScheduleCallback(interval time.Duration, fun tw.Event)

func (*VarManager) SetInactive

func (vm *VarManager) SetInactive(v *Var)

var.VarLifecycle interface

func (*VarManager) Status

func (vm *VarManager) Status(sc *server.StatusConsumer)

func (*VarManager) TopologyChanged

func (vm *VarManager) TopologyChanged(topology *configuration.Topology, done func(bool))

type VarWriteSubscriber

type VarWriteSubscriber struct {
	Observe func(v *Var, value []byte, references *msgs.VarIdPos_List, txn *Txn)
	Cancel  func(v *Var)
}

type VectorClock

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

func NewVectorClock

func NewVectorClock() *VectorClock

func VectorClockFromData

func VectorClockFromData(vcData []byte, forceDecode bool) *VectorClock

func (*VectorClock) AsData

func (vc *VectorClock) AsData() []byte

func (*VectorClock) AsMutable

func (vc *VectorClock) AsMutable() *VectorClockMutable

func (*VectorClock) At

func (vc *VectorClock) At(vUUId *common.VarUUId) uint64

func (*VectorClock) ForEach

func (vc *VectorClock) ForEach(it func(*common.VarUUId, uint64) bool) bool

func (*VectorClock) Len

func (vc *VectorClock) Len() int

func (*VectorClock) LessThan

func (vcA *VectorClock) LessThan(vcB VectorClockInterface) bool

func (*VectorClock) String

func (vc *VectorClock) String() string

type VectorClockInterface

type VectorClockInterface interface {
	Len() int
	ForEach(func(*common.VarUUId, uint64) bool) bool
	At(*common.VarUUId) uint64
	LessThan(VectorClockInterface) bool
	AsMutable() *VectorClockMutable
	AsData() []byte
}

type VectorClockMutable

type VectorClockMutable struct {
	*VectorClock
	// contains filtered or unexported fields
}

func (*VectorClockMutable) AsData

func (vc *VectorClockMutable) AsData() []byte

func (*VectorClockMutable) AsMutable

func (vc *VectorClockMutable) AsMutable() *VectorClockMutable

func (*VectorClockMutable) At

func (vc *VectorClockMutable) At(vUUId *common.VarUUId) uint64

func (*VectorClockMutable) Bump

func (*VectorClockMutable) Clone

func (vcA *VectorClockMutable) Clone() *VectorClockMutable

func (*VectorClockMutable) Delete

func (*VectorClockMutable) DeleteIfMatch

func (vc *VectorClockMutable) DeleteIfMatch(vUUId *common.VarUUId, v uint64) bool

func (*VectorClockMutable) ForEach

func (vc *VectorClockMutable) ForEach(it func(*common.VarUUId, uint64) bool) bool

func (*VectorClockMutable) Len

func (vc *VectorClockMutable) Len() int

func (*VectorClockMutable) LessThan

func (vcA *VectorClockMutable) LessThan(vcB VectorClockInterface) bool

func (*VectorClockMutable) MergeInMax

func (vcA *VectorClockMutable) MergeInMax(vcB VectorClockInterface) bool

func (*VectorClockMutable) MergeInMissing

func (vcA *VectorClockMutable) MergeInMissing(vcB VectorClockInterface) bool

func (*VectorClockMutable) SetVarIdMax

func (vc *VectorClockMutable) SetVarIdMax(vUUId *common.VarUUId, v uint64) bool

func (*VectorClockMutable) String

func (vc *VectorClockMutable) String() string

type Vote

type Vote msgs.Vote_Which

func (Vote) String

func (v Vote) String() string

func (Vote) ToVoteEnum

func (v Vote) ToVoteEnum() msgs.VoteEnum

Jump to

Keyboard shortcuts

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