interfaces

package
v1.22.28 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppError added in v1.22.28

type AppError struct {
	Code    int32
	Message string
}

AppError represents an application-level error

func (*AppError) Error added in v1.22.28

func (e *AppError) Error() string

Error implements error interface

type AppHandler added in v1.22.28

type AppHandler interface {
	// AppRequest handles an application-level request from a node.
	AppRequest(ctx context.Context, nodeID ids.NodeID, requestID uint32, deadline time.Time, request []byte) error

	// AppRequestFailed handles a failed application-level request.
	AppRequestFailed(ctx context.Context, nodeID ids.NodeID, requestID uint32, appErr *AppError) error

	// AppResponse handles an application-level response from a node.
	AppResponse(ctx context.Context, nodeID ids.NodeID, requestID uint32, response []byte) error

	// AppGossip handles an application-level gossip from a node.
	AppGossip(ctx context.Context, nodeID ids.NodeID, msg []byte) error
}

AppHandler handles application-level messages from nodes.

type AppSender added in v1.22.28

type AppSender interface {
	// SendAppRequest sends an application-level request to the given nodes.
	SendAppRequest(ctx context.Context, nodeIDs set.Set[ids.NodeID], requestID uint32, appRequestBytes []byte) error

	// SendAppResponse sends an application-level response to the given node.
	SendAppResponse(ctx context.Context, nodeID ids.NodeID, requestID uint32, appResponseBytes []byte) error

	// SendAppError sends an application-level error to the given node.
	SendAppError(ctx context.Context, nodeID ids.NodeID, requestID uint32, errorCode int32, errorMessage string) error

	// SendAppGossip sends an application-level gossip to all connected nodes.
	SendAppGossip(ctx context.Context, nodeIDs set.Set[ids.NodeID], appGossipBytes []byte) error

	// SendAppGossipSpecific sends an application-level gossip to specific nodes.
	SendAppGossipSpecific(ctx context.Context, nodeIDs set.Set[ids.NodeID], appGossipBytes []byte) error
}

AppSender sends application-level messages.

type Engine

type Engine interface {
	// Start starts the engine
	Start(context.Context, uint32) error

	// Stop stops the engine
	Stop(context.Context) error

	// HealthCheck performs health check
	HealthCheck(context.Context) (interface{}, error)

	// IsBootstrapped checks if bootstrapped
	IsBootstrapped() bool
}

Engine defines the consensus engine interface

type Fx added in v1.22.28

type Fx struct {
	ID ids.ID
	Fx FxInterface
}

Fx is a feature extension wrapper with ID

type FxInterface added in v1.22.28

type FxInterface interface {
	// Initialize initializes the Fx
	Initialize(vm interface{}) error
	// Bootstrapping is called when the chain is bootstrapping
	Bootstrapping() error
	// Bootstrapped is called when the chain is done bootstrapping
	Bootstrapped() error
}

FxInterface is a feature extension interface

type VM

type VM interface {
	// Initialize initializes the VM
	Initialize(context.Context, *VMConfig) error

	// Shutdown shuts down the VM
	Shutdown(context.Context) error

	// Version returns VM version
	Version(context.Context) (string, error)
}

VM defines a virtual machine

type VMConfig

type VMConfig struct {
	ChainID   ids.ID
	NetworkID uint32
	NodeID    ids.NodeID
	PublicKey []byte
}

VMConfig defines VM configuration

Jump to

Keyboard shortcuts

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