message

package
v1.11.1 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2024 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CodecVersion = 0
)

Variables

View Source
var (
	ErrUnexpectedCodecVersion = errors.New("unexpected codec version")
)

Functions

func Build

func Build(msg Message) ([]byte, error)

Types

type Handler

type Handler interface {
	HandleTx(nodeID ids.NodeID, requestID uint32, msg *Tx) error
}

type Message

type Message interface {
	// Handle this message with the correct message handler
	Handle(handler Handler, nodeID ids.NodeID, requestID uint32) error

	// Bytes returns the binary representation of this message
	//
	// Bytes should only be called after being initialized
	Bytes() []byte
	// contains filtered or unexported methods
}

func Parse

func Parse(bytes []byte) (Message, error)

type NoopHandler

type NoopHandler struct {
	Log logging.Logger
}

func (NoopHandler) HandleTx

func (h NoopHandler) HandleTx(nodeID ids.NodeID, requestID uint32, _ *Tx) error

type Tx

type Tx struct {
	Tx []byte `serialize:"true"`
	// contains filtered or unexported fields
}

func (*Tx) Bytes

func (m *Tx) Bytes() []byte

func (*Tx) Handle

func (msg *Tx) Handle(handler Handler, nodeID ids.NodeID, requestID uint32) error

Jump to

Keyboard shortcuts

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