types

package
v0.0.0-...-25e1a75 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Pending = iota
	Propose
	Vote
	PreCommit
	Commit
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Address

type Address struct {
	Id   string `json:"id"`
	Ip   net.IP `json:"ip"`
	Port uint16 `json:"port"`
}

func NewAddress

func NewAddress(addr string) (*Address, error)

func (*Address) ToIpPortString

func (a *Address) ToIpPortString() string

type CommitMessage

type CommitMessage struct {
	Height    int    `json:"height"`
	Validator string `json:"validator"`
}

func (*CommitMessage) Serialize

func (m *CommitMessage) Serialize() []byte

type Message

type Message interface {
	GetData() []byte
}

type MessageInfo

type MessageInfo struct {
	MsgType    int    `json:"msgType"`
	MsgContent string `json:"msgContent"`
}

func NewMessageInfo

func NewMessageInfo(o Serializable) *MessageInfo

func (*MessageInfo) GetData

func (m *MessageInfo) GetData() []byte

type NodeInfoMessage

type NodeInfoMessage struct {
	Id   string `json:"id"`
	Ip   string `json:"ip"`
	Port uint16 `json:"port"`
}

func (*NodeInfoMessage) GetData

func (m *NodeInfoMessage) GetData() []byte

type PacketMsg

type PacketMsg struct {
	ChannelID int32
	EOF       int32
	Data      []byte
}

func (*PacketMsg) GetData

func (m *PacketMsg) GetData() []byte

type PreCommitMessage

type PreCommitMessage struct {
	Height    int    `json:"height"`
	Validator string `json:"validator"`
}

func (*PreCommitMessage) Serialize

func (m *PreCommitMessage) Serialize() []byte

type ProposeMessage

type ProposeMessage struct {
	Height    int    `json:"height"`
	Data      string `json:"data"`
	Validator string `json:"validator"`
	Signer    string `json:"signer"`
}

func (*ProposeMessage) Serialize

func (m *ProposeMessage) Serialize() []byte

type Serializable

type Serializable interface {
	Serialize() []byte
}

type VoteMessage

type VoteMessage struct {
	Height    int    `json:"height"`
	Validator string `json:"validator"`
}

func (*VoteMessage) Serialize

func (m *VoteMessage) Serialize() []byte

Jump to

Keyboard shortcuts

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