appsender

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2025 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAdapter

func NewAdapter(sender AppSender) core.AppSender

NewAdapter creates a new adapter that converts AppSender to core.AppSender

Types

type Adapter

type Adapter struct {
	// contains filtered or unexported fields
}

Adapter adapts an AppSender to core.AppSender interface

func (*Adapter) SendAppError

func (a *Adapter) SendAppError(ctx context.Context, nodeID ids.NodeID, requestID uint32, errorCode int32, errorMessage string) error

SendAppError implements core.AppSender

func (*Adapter) SendAppGossip

func (a *Adapter) SendAppGossip(ctx context.Context, msg []byte) error

SendAppGossip implements core.AppSender

func (*Adapter) SendAppRequest

func (a *Adapter) SendAppRequest(ctx context.Context, nodeIDs []ids.NodeID, requestID uint32, msg []byte) error

SendAppRequest implements core.AppSender

func (*Adapter) SendAppResponse

func (a *Adapter) SendAppResponse(ctx context.Context, nodeID ids.NodeID, requestID uint32, msg []byte) error

SendAppResponse implements core.AppSender

func (*Adapter) SendCrossChainAppRequest

func (a *Adapter) SendCrossChainAppRequest(ctx context.Context, chainID ids.ID, requestID uint32, msg []byte) error

SendCrossChainAppRequest implements core.AppSender

func (*Adapter) SendCrossChainAppResponse

func (a *Adapter) SendCrossChainAppResponse(ctx context.Context, chainID ids.ID, requestID uint32, msg []byte) error

SendCrossChainAppResponse implements core.AppSender

type AppSender

type AppSender interface {
	// SendAppRequest sends an application-level request to the given nodes.
	// The VM corresponding to this AppSender may receive either:
	// * An AppResponse from nodeID with ID [requestID]
	// * An AppRequestFailed from nodeID with ID [requestID]
	// A nil return value guarantees that the VM corresponding to this AppSender
	// will receive exactly one of the above messages.
	SendAppRequest(ctx context.Context, nodeIDs set.Set[ids.NodeID], requestID uint32, message []byte) error

	// SendAppResponse sends an application-level response to a request.
	// This response must be in response to an AppRequest that the VM corresponding
	// to this AppSender received from [nodeID] with ID [requestID].
	SendAppResponse(ctx context.Context, nodeID ids.NodeID, requestID uint32, message []byte) error

	// SendAppGossip sends an application-level gossip message.
	SendAppGossip(ctx context.Context, config SendConfig, message []byte) error

	// SendAppGossipSpecific sends an application-level gossip message to a set of peers.
	SendAppGossipSpecific(ctx context.Context, nodeIDs set.Set[ids.NodeID], message []byte) error

	// SendCrossChainAppRequest sends an application-level request to a specific chain.
	SendCrossChainAppRequest(ctx context.Context, chainID ids.ID, requestID uint32, message []byte) error

	// SendCrossChainAppResponse sends an application-level response to a specific chain.
	// This response must be in response to a CrossChainAppRequest that the VM corresponding
	// to this AppSender received from [chainID] with ID [requestID].
	SendCrossChainAppResponse(ctx context.Context, chainID ids.ID, requestID uint32, message []byte) error
}

AppSender sends application-level messages to VMs

type SendConfig

type SendConfig struct {
	// Validators are the validators to send the message to
	Validators set.Set[ids.NodeID]
	// NonValidators are the non-validators to send the message to
	NonValidators set.Set[ids.NodeID]
}

SendConfig configures how a message is sent

Jump to

Keyboard shortcuts

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