message

package
v0.0.0-...-f68e772 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2015 License: Apache-2.0 Imports: 2 Imported by: 15

Documentation

Index

Constants

View Source
const (
	ProposeMsg uint8 = iota + 1
	PreAcceptMsg
	PreAcceptOkMsg
	PreAcceptReplyMsg
	AcceptMsg
	AcceptReplyMsg
	CommitMsg
	PrepareMsg
	PrepareReplyMsg
	TimeoutMsg
)

Variables

This section is empty.

Functions

func MessageTypeString

func MessageTypeString(m Message) string

Types

type Accept

type Accept struct {
	ReplicaId  uint8
	InstanceId uint64
	Cmds       Commands
	Deps       Dependencies
	Ballot     *Ballot
	From       uint8
}

func (*Accept) Content

func (a *Accept) Content() interface{}

func (*Accept) Instance

func (p *Accept) Instance() uint64

func (*Accept) Replica

func (p *Accept) Replica() uint8

func (*Accept) Sender

func (a *Accept) Sender() uint8

func (*Accept) String

func (p *Accept) String() string

func (*Accept) Type

func (a *Accept) Type() uint8

type AcceptReply

type AcceptReply struct {
	ReplicaId  uint8
	InstanceId uint64
	Ballot     *Ballot
	From       uint8
}

func (*AcceptReply) Content

func (a *AcceptReply) Content() interface{}

func (*AcceptReply) Instance

func (p *AcceptReply) Instance() uint64

func (*AcceptReply) Replica

func (p *AcceptReply) Replica() uint8

func (*AcceptReply) Sender

func (a *AcceptReply) Sender() uint8

func (*AcceptReply) String

func (p *AcceptReply) String() string

func (*AcceptReply) Type

func (a *AcceptReply) Type() uint8

type Ballot

type Ballot struct {
	Epoch     uint32
	Number    uint64
	ReplicaId uint8
}

func NewBallot

func NewBallot(epoch uint32, number uint64, replicId uint8) *Ballot

func (*Ballot) Clone

func (b *Ballot) Clone() *Ballot

func (*Ballot) Compare

func (b *Ballot) Compare(other *Ballot) int

func (*Ballot) FromUint64

func (b *Ballot) FromUint64(num uint64)

func (*Ballot) GetEpoch

func (b *Ballot) GetEpoch() uint32

func (*Ballot) GetNumber

func (b *Ballot) GetNumber() uint64

func (*Ballot) GetReplicaId

func (b *Ballot) GetReplicaId() uint8

func (*Ballot) IncNumClone

func (b *Ballot) IncNumClone() *Ballot

func (*Ballot) IncNumber

func (b *Ballot) IncNumber()

func (*Ballot) IsInitialBallot

func (b *Ballot) IsInitialBallot() bool

func (*Ballot) SetNumber

func (b *Ballot) SetNumber(number uint64)

func (*Ballot) SetReplicaId

func (b *Ballot) SetReplicaId(rId uint8)

func (*Ballot) String

func (b *Ballot) String() string

func (*Ballot) ToUint64

func (b *Ballot) ToUint64() uint64

type Command

type Command []byte

func (Command) Clone

func (c Command) Clone() Command

func (Command) Compare

func (self Command) Compare(other Command) int

type Commands

type Commands []Command

func (Commands) Clone

func (c Commands) Clone() Commands

type Commit

type Commit struct {
	ReplicaId  uint8
	InstanceId uint64
	Cmds       Commands
	Deps       Dependencies
	From       uint8
}

func (*Commit) Content

func (c *Commit) Content() interface{}

func (*Commit) Instance

func (c *Commit) Instance() uint64

func (*Commit) Replica

func (c *Commit) Replica() uint8

func (*Commit) Sender

func (c *Commit) Sender() uint8

func (*Commit) String

func (c *Commit) String() string

func (*Commit) Type

func (c *Commit) Type() uint8

type Dependencies

type Dependencies []uint64

func (Dependencies) Clone

func (d Dependencies) Clone() Dependencies

func (Dependencies) SameAs

func (d Dependencies) SameAs(other Dependencies) bool

func (Dependencies) Union

func (d Dependencies) Union(other Dependencies) bool

union unions the deps into the receiver return true if deps are changed

type Message

type Message interface {
	Sender() uint8
	Type() uint8
	Content() interface{}
	Replica() uint8
	Instance() uint64
	String() string
}

type PreAccept

type PreAccept struct {
	ReplicaId  uint8
	InstanceId uint64
	Cmds       Commands
	Deps       Dependencies
	Ballot     *Ballot
	From       uint8
}

func (*PreAccept) Content

func (p *PreAccept) Content() interface{}

func (*PreAccept) Instance

func (p *PreAccept) Instance() uint64

func (*PreAccept) Replica

func (p *PreAccept) Replica() uint8

func (*PreAccept) Sender

func (p *PreAccept) Sender() uint8

PreAccept

func (*PreAccept) String

func (p *PreAccept) String() string

func (*PreAccept) Type

func (p *PreAccept) Type() uint8

type PreAcceptOk

type PreAcceptOk struct {
	ReplicaId  uint8
	InstanceId uint64
	From       uint8
}

we don't need ReplicaId in PreAcceptOk, because only the leader will receive this message.

func (*PreAcceptOk) Content

func (p *PreAcceptOk) Content() interface{}

func (*PreAcceptOk) Instance

func (p *PreAcceptOk) Instance() uint64

func (*PreAcceptOk) Replica

func (p *PreAcceptOk) Replica() uint8

func (*PreAcceptOk) Sender

func (p *PreAcceptOk) Sender() uint8

PreAcceptOk

func (*PreAcceptOk) String

func (p *PreAcceptOk) String() string

func (*PreAcceptOk) Type

func (p *PreAcceptOk) Type() uint8

type PreAcceptReply

type PreAcceptReply struct {
	ReplicaId  uint8
	InstanceId uint64
	Deps       Dependencies
	Ballot     *Ballot
	From       uint8
}

func (*PreAcceptReply) Content

func (p *PreAcceptReply) Content() interface{}

func (*PreAcceptReply) Instance

func (p *PreAcceptReply) Instance() uint64

func (*PreAcceptReply) Replica

func (p *PreAcceptReply) Replica() uint8

func (*PreAcceptReply) Sender

func (p *PreAcceptReply) Sender() uint8

PreAcceptReply

func (*PreAcceptReply) String

func (p *PreAcceptReply) String() string

func (*PreAcceptReply) Type

func (p *PreAcceptReply) Type() uint8

type Prepare

type Prepare struct {
	ReplicaId  uint8
	InstanceId uint64
	Ballot     *Ballot
	From       uint8
}

func (*Prepare) Content

func (p *Prepare) Content() interface{}

func (*Prepare) Instance

func (p *Prepare) Instance() uint64

func (*Prepare) Replica

func (p *Prepare) Replica() uint8

func (*Prepare) Sender

func (p *Prepare) Sender() uint8

func (*Prepare) String

func (p *Prepare) String() string

func (*Prepare) Type

func (p *Prepare) Type() uint8

type PrepareReply

type PrepareReply struct {
	ReplicaId  uint8
	InstanceId uint64
	Status     uint8
	Cmds       Commands
	Deps       Dependencies
	Ballot     *Ballot
	// These two are used for identical non orignal leader pre-accept reply
	OriginalBallot *Ballot
	IsFromLeader   bool
	From           uint8
}

func (*PrepareReply) Content

func (p *PrepareReply) Content() interface{}

func (*PrepareReply) Instance

func (p *PrepareReply) Instance() uint64

func (*PrepareReply) Replica

func (p *PrepareReply) Replica() uint8

func (*PrepareReply) Sender

func (p *PrepareReply) Sender() uint8

func (*PrepareReply) String

func (p *PrepareReply) String() string

func (*PrepareReply) Type

func (p *PrepareReply) Type() uint8

type Propose

type Propose struct {
	ReplicaId  uint8
	InstanceId uint64
	Cmds       Commands
	Created    chan struct{}
	From       uint8
}

func NewPropose

func NewPropose(rid uint8, iid uint64, cmds Commands) *Propose

func (*Propose) Content

func (p *Propose) Content() interface{}

func (*Propose) Instance

func (p *Propose) Instance() uint64

func (*Propose) Replica

func (p *Propose) Replica() uint8

func (*Propose) Sender

func (p *Propose) Sender() uint8

func (*Propose) String

func (p *Propose) String() string

func (*Propose) Type

func (p *Propose) Type() uint8

type Timeout

type Timeout struct {
	ReplicaId  uint8
	InstanceId uint64
	From       uint8
}

func (*Timeout) Content

func (t *Timeout) Content() interface{}

func (*Timeout) Instance

func (t *Timeout) Instance() uint64

func (*Timeout) Replica

func (t *Timeout) Replica() uint8

func (*Timeout) Sender

func (t *Timeout) Sender() uint8

func (*Timeout) String

func (t *Timeout) String() string

func (*Timeout) Type

func (t *Timeout) Type() uint8

Jump to

Keyboard shortcuts

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