message

package
Version: v0.0.0-...-0efea2d Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2021 License: GPL-3.0 Imports: 2 Imported by: 5

Documentation

Index

Constants

View Source
const MaxFaultyNode = 1
View Source
const TotalNodeNO = 3*MaxFaultyNode + 1

Variables

This section is empty.

Functions

func Digest

func Digest(v interface{}) string

func PortByID

func PortByID(id int64) int

Types

type CheckPoint

type CheckPoint struct {
	SequenceID int64  `json:"sequenceID"`
	Digest     string `json:"digest"`
	ViewID     int64  `json:"viewID"`
	NodeID     int64  `json:"nodeID"`
}

type Commit

type Commit struct {
	ViewID     int64  `json:"viewID"`
	SequenceID int64  `json:"sequenceID"`
	Digest     string `json:"digest"`
	NodeID     int64  `json:"nodeID"`
}

type ConMessage

type ConMessage struct {
	Typ     MType  `json:"type"`
	Sig     string `json:"sig"`
	From    string `json:"from"`
	Payload []byte `json:"payload"`
}

func CreateConMsg

func CreateConMsg(t MType, msg interface{}) *ConMessage

func (*ConMessage) String

func (cm *ConMessage) String() string

func (*ConMessage) Verify

func (cm *ConMessage) Verify() bool

type MType

type MType int16
const (
	MTPrePrepare MType = iota
	MTRequest
	MTPrepare
	MTCommit
	MTCheckpoint
	MTViewChange
	MTNewView
)

func (MType) String

func (mt MType) String() string

type NewView

type NewView struct {
	NewViewID int64    `json:"newViewID"`
	VMsg      VMessage `json:"vMSG"`
	OMsg      OMessage `json:"oMSG"`
	NMsg      OMessage `json:"nMSG"`
}

type OMessage

type OMessage map[int64]*PrePrepare

func (OMessage) EQ

func (m OMessage) EQ(msg OMessage) bool

type PTuple

type PTuple struct {
	PPMsg *PrePrepare `json:"pre-prepare"`
	PMsg  PrepareMsg  `json:"prepare"`
}

type PrePrepare

type PrePrepare struct {
	ViewID     int64  `json:"viewID"`
	SequenceID int64  `json:"sequenceID"`
	Digest     string `json:"digest"`
}

type Prepare

type Prepare struct {
	ViewID     int64  `json:"viewID"`
	SequenceID int64  `json:"sequenceID"`
	Digest     string `json:"digest"`
	NodeID     int64  `json:"nodeID"`
}

type PrepareMsg

type PrepareMsg map[int64]*Prepare

type Reply

type Reply struct {
	SeqID     int64  `json:"sequenceID"`
	ViewID    int64  `json:"viewID"`
	Timestamp int64  `json:"timestamp"`
	ClientID  string `json:"clientID"`
	NodeID    int64  `json:"nodeID"`
	Result    string `json:"result"`
}

type Request

type Request struct {
	SeqID     int64  `json:"sequenceID"`
	TimeStamp int64  `json:"timestamp"`
	ClientID  string `json:"clientID"`
	Operation string `json:"operation"`
}

func (*Request) String

func (r *Request) String() string

type RequestRecord

type RequestRecord struct {
	*PrePrepare
	*Request
}

type VMessage

type VMessage map[int64]*ViewChange

type ViewChange

type ViewChange struct {
	NewViewID int64                 `json:"newViewID"`
	LastCPSeq int64                 `json:"lastCPSeq"`
	NodeID    int64                 `json:"nodeID"`
	CMsg      map[int64]*CheckPoint `json:"cMsg"`
	PMsg      map[int64]*PTuple     `json:"pMsg"`
}

func (*ViewChange) Digest

func (vc *ViewChange) Digest() string

Jump to

Keyboard shortcuts

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