Documentation
¶
Index ¶
- func NewAdapter(sender AppSender) core.AppSender
- type Adapter
- func (a *Adapter) SendAppError(ctx context.Context, nodeID ids.NodeID, requestID uint32, errorCode int32, ...) error
- func (a *Adapter) SendAppGossip(ctx context.Context, msg []byte) error
- func (a *Adapter) SendAppRequest(ctx context.Context, nodeIDs []ids.NodeID, requestID uint32, msg []byte) error
- func (a *Adapter) SendAppResponse(ctx context.Context, nodeID ids.NodeID, requestID uint32, msg []byte) error
- func (a *Adapter) SendCrossChainAppRequest(ctx context.Context, chainID ids.ID, requestID uint32, msg []byte) error
- func (a *Adapter) SendCrossChainAppResponse(ctx context.Context, chainID ids.ID, requestID uint32, msg []byte) error
- type AppSender
- type Client
- func (c *Client) SendAppError(ctx context.Context, nodeID ids.NodeID, requestID uint32, errorCode int32, ...) error
- func (c *Client) SendAppGossip(ctx context.Context, msg []byte) error
- func (c *Client) SendAppRequest(ctx context.Context, nodeIDs []ids.NodeID, requestID uint32, msg []byte) error
- func (c *Client) SendAppResponse(ctx context.Context, nodeID ids.NodeID, requestID uint32, msg []byte) error
- func (c *Client) SendCrossChainAppRequest(ctx context.Context, chainID ids.ID, requestID uint32, msg []byte) error
- func (c *Client) SendCrossChainAppResponse(ctx context.Context, chainID ids.ID, requestID uint32, msg []byte) error
- type GRPCServer
- func (s *GRPCServer) SendAppError(ctx context.Context, req *appsenderpb.SendAppErrorMsg) (*emptypb.Empty, error)
- func (s *GRPCServer) SendAppGossip(ctx context.Context, req *appsenderpb.SendAppGossipMsg) (*emptypb.Empty, error)
- func (s *GRPCServer) SendAppRequest(ctx context.Context, req *appsenderpb.SendAppRequestMsg) (*emptypb.Empty, error)
- func (s *GRPCServer) SendAppResponse(ctx context.Context, req *appsenderpb.SendAppResponseMsg) (*emptypb.Empty, error)
- type SendConfig
- type Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewAdapter ¶
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 ¶
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
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 Client ¶ added in v1.1.11
type Client struct {
// contains filtered or unexported fields
}
Client is a gRPC client that implements AppSender
func NewClient ¶ added in v1.1.11
func NewClient(client appsenderpb.AppSenderClient) *Client
NewClient creates a new gRPC app sender client
func (*Client) SendAppError ¶ added in v1.1.11
func (c *Client) SendAppError(ctx context.Context, nodeID ids.NodeID, requestID uint32, errorCode int32, errorMessage string) error
SendAppError implements AppSender
func (*Client) SendAppGossip ¶ added in v1.1.11
SendAppGossip implements AppSender
func (*Client) SendAppRequest ¶ added in v1.1.11
func (c *Client) SendAppRequest(ctx context.Context, nodeIDs []ids.NodeID, requestID uint32, msg []byte) error
SendAppRequest implements AppSender
func (*Client) SendAppResponse ¶ added in v1.1.11
func (c *Client) SendAppResponse(ctx context.Context, nodeID ids.NodeID, requestID uint32, msg []byte) error
SendAppResponse implements AppSender
type GRPCServer ¶
type GRPCServer struct {
appsenderpb.UnimplementedAppSenderServer
// contains filtered or unexported fields
}
GRPCServer wraps a core.AppSender to implement the gRPC AppSenderServer interface
func NewGRPCServer ¶
func NewGRPCServer(appSender core.AppSender) *GRPCServer
NewGRPCServer creates a new gRPC server wrapper for AppSender
func (*GRPCServer) SendAppError ¶
func (s *GRPCServer) SendAppError(ctx context.Context, req *appsenderpb.SendAppErrorMsg) (*emptypb.Empty, error)
SendAppError implements the gRPC AppSenderServer interface
func (*GRPCServer) SendAppGossip ¶
func (s *GRPCServer) SendAppGossip(ctx context.Context, req *appsenderpb.SendAppGossipMsg) (*emptypb.Empty, error)
SendAppGossip implements the gRPC AppSenderServer interface
func (*GRPCServer) SendAppRequest ¶
func (s *GRPCServer) SendAppRequest(ctx context.Context, req *appsenderpb.SendAppRequestMsg) (*emptypb.Empty, error)
SendAppRequest implements the gRPC AppSenderServer interface
func (*GRPCServer) SendAppResponse ¶
func (s *GRPCServer) SendAppResponse(ctx context.Context, req *appsenderpb.SendAppResponseMsg) (*emptypb.Empty, error)
SendAppResponse implements the gRPC AppSenderServer interface