handler

package
v1.22.2 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2025 License: BSD-3-Clause Imports: 2 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler interface {
	// HandleInbound handles inbound messages
	HandleInbound(context.Context, Message) error

	// HandleOutbound handles outbound messages
	HandleOutbound(context.Context, Message) error

	// Connected handles node connection
	Connected(context.Context, ids.NodeID) error

	// Disconnected handles node disconnection
	Disconnected(context.Context, ids.NodeID) error
}

Handler handles network messages

type Message

type Message struct {
	NodeID    ids.NodeID
	RequestID uint32
	Op        Op
	Message   []byte
}

Message represents a network message

type Op

type Op byte

Op represents an operation

const (
	// GetAcceptedFrontier gets accepted frontier
	GetAcceptedFrontier Op = iota
	// AcceptedFrontier is accepted frontier response
	AcceptedFrontier
	// GetAccepted gets accepted
	GetAccepted
	// Accepted is accepted response
	Accepted
	// Get gets an item
	Get
	// Put puts an item
	Put
	// PushQuery pushes a query
	PushQuery
	// PullQuery pulls a query
	PullQuery
	// Chits is chits response
	Chits
)

Jump to

Keyboard shortcuts

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