message

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: May 3, 2023 License: GPL-3.0 Imports: 5 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// SSVSyncMsgType extends spec msg type
	SSVSyncMsgType spectypes.MsgType = 100
	// SSVEventMsgType extends spec msg type
	SSVEventMsgType spectypes.MsgType = 200
)
View Source
const EntryNotFoundError = "EntryNotFoundError"

EntryNotFoundError is the error message for when an entry is not found

Variables

This section is empty.

Functions

func Aggregate

func Aggregate(signedMsg *specqbft.SignedMessage, s spectypes.MessageSignature) error

Aggregate is a utility that helps to ensure sorted signers

func BeaconRoleFromString

func BeaconRoleFromString(s string) (spectypes.BeaconRole, error)

BeaconRoleFromString returns BeaconRole from string

func MsgTypeToString

func MsgTypeToString(mt spectypes.MsgType) string

MsgTypeToString extension for spec msg type. convert spec msg type to string

Types

type Encoder

type Encoder interface {
	// Encode encodes the message
	Encode() ([]byte, error)
	// Decode decodes the message
	Decode(data []byte) error
}

Encoder encodes or decodes the message

type StatusCode

type StatusCode uint32

StatusCode is the response status code

const (
	// StatusUnknown represents an unknown state
	StatusUnknown StatusCode = iota
	// StatusSuccess means the request went successfully
	StatusSuccess
	// StatusNotFound means the desired objects were not found
	StatusNotFound
	// StatusError means that the node experienced some general error
	StatusError
	// StatusBadRequest means the request was bad
	StatusBadRequest
	// StatusInternalError means that the node experienced an internal error
	StatusInternalError
	// StatusBackoff means we exceeded rate limits for the protocol
	StatusBackoff
)

func (*StatusCode) String

func (sc *StatusCode) String() string

type SyncMessage

type SyncMessage struct {
	// Protocol is the protocol of the message
	// TODO: remove after v0
	Protocol SyncMsgType
	// Params holds request parameters
	Params *SyncParams
	// Data holds the results
	Data []*specqbft.SignedMessage
	// Status is the status code of the operation
	Status StatusCode
}

SyncMessage is the message being passed in sync operations

func (*SyncMessage) Decode

func (sm *SyncMessage) Decode(data []byte) error

Decode decodes the message

func (*SyncMessage) Encode

func (sm *SyncMessage) Encode() ([]byte, error)

Encode encodes the message

func (*SyncMessage) UpdateResults

func (sm *SyncMessage) UpdateResults(err error, results ...*specqbft.SignedMessage)

UpdateResults updates the given sync message with results or potential error

type SyncMsgType

type SyncMsgType int32

SyncMsgType represent the type of sync messages TODO: remove after v0

const (
	// LastDecidedType is the last decided message type
	LastDecidedType SyncMsgType = iota
	// DecidedHistoryType is the decided history message type
	DecidedHistoryType
)

type SyncParams

type SyncParams struct {
	// Height of the message, it can hold up to 2 items to specify a range or a single item for specific height
	Height []specqbft.Height
	// Identifier of the message
	Identifier spectypes.MessageID
}

SyncParams holds parameters for sync operations

Jump to

Keyboard shortcuts

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