handler

package
v1.22.41 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	GetAcceptedFrontier = router.GetAcceptedFrontier
	AcceptedFrontier    = router.AcceptedFrontier
	GetAccepted         = router.GetAccepted
	Accepted            = router.Accepted
	Get                 = router.Get
	Put                 = router.Put
	PushQuery           = router.PushQuery
	PullQuery           = router.PullQuery
	Chits               = router.Chits
)

Op constants re-exported from core/router

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 NotificationForwarder added in v1.22.3

type NotificationForwarder struct {
	Engine    Notifier
	Subscribe Subscription
	Log       log.Logger
	// contains filtered or unexported fields
}

NotificationForwarder forwards VM notifications to the consensus engine

func NewNotificationForwarder added in v1.22.3

func NewNotificationForwarder(engine Notifier, subscribe Subscription, logger log.Logger) *NotificationForwarder

NewNotificationForwarder creates a new NotificationForwarder

func (*NotificationForwarder) CheckForEvent added in v1.22.3

func (nf *NotificationForwarder) CheckForEvent()

CheckForEvent triggers a new subscription if the forwarder is waiting This should be called when the VM state changes (e.g., after SetPreference, BuildBlock)

func (*NotificationForwarder) Start added in v1.22.3

func (nf *NotificationForwarder) Start()

Start begins the notification forwarding loop

func (*NotificationForwarder) Stop added in v1.22.3

func (nf *NotificationForwarder) Stop()

Stop stops the notification forwarding loop

type Notifier added in v1.22.3

type Notifier interface {
	// Notify is called when the VM has a message for the consensus engine
	Notify(context.Context, VMMessage) error
}

Notifier is the interface for receiving VM notifications

type Op

type Op = router.Op

Op re-exports from core/router for consistency

type Subscription added in v1.22.3

type Subscription func(context.Context) (VMMessage, error)

Subscription is a function that waits for VM events

type VMMessage added in v1.22.3

type VMMessage = engine.Message

VMMessage is an alias for engine.Message

Jump to

Keyboard shortcuts

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