rpcchainvm

package
v1.11.10 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2024 License: BSD-3-Clause Imports: 60 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFactory added in v1.11.10

func NewFactory(
	path string,
	processTracker resource.ProcessTracker,
	runtimeTracker runtime.Tracker,
	metricsGatherer metrics.MultiGatherer,
) vms.Factory

func Serve added in v1.11.10

func Serve(ctx context.Context, vm block.ChainVM, opts ...grpcutils.ServerOption) error

The address of the Runtime server is expected to be passed via ENV `runtime.EngineAddressKey`. This address is used by the Runtime client to send Initialize RPC to server.

Serve starts the RPC Chain VM server and performs a handshake with the VM runtime service.

Types

type VMClient

type VMClient struct {
	*chain.State
	// contains filtered or unexported fields
}

VMClient is an implementation of a VM that talks over RPC.

func NewClient

func NewClient(
	clientConn *grpc.ClientConn,
	runtime runtime.Stopper,
	pid int,
	processTracker resource.ProcessTracker,
	metricsGatherer metrics.MultiGatherer,
) *VMClient

NewClient returns a VM connected to a remote VM

func (*VMClient) AppGossip added in v1.11.10

func (vm *VMClient) AppGossip(ctx context.Context, nodeID ids.NodeID, msg []byte) error

func (*VMClient) AppRequest added in v1.11.10

func (vm *VMClient) AppRequest(ctx context.Context, nodeID ids.NodeID, requestID uint32, deadline time.Time, request []byte) error

func (*VMClient) AppRequestFailed added in v1.11.10

func (vm *VMClient) AppRequestFailed(ctx context.Context, nodeID ids.NodeID, requestID uint32, appErr *common.AppError) error

func (*VMClient) AppResponse added in v1.11.10

func (vm *VMClient) AppResponse(ctx context.Context, nodeID ids.NodeID, requestID uint32, response []byte) error

func (*VMClient) Connected added in v1.11.10

func (vm *VMClient) Connected(ctx context.Context, nodeID ids.NodeID, nodeVersion *version.Application) error

func (*VMClient) CreateHandlers

func (vm *VMClient) CreateHandlers(ctx context.Context) (map[string]http.Handler, error)

func (*VMClient) CrossChainAppRequest added in v1.11.10

func (vm *VMClient) CrossChainAppRequest(ctx context.Context, chainID ids.ID, requestID uint32, deadline time.Time, request []byte) error

func (*VMClient) CrossChainAppRequestFailed added in v1.11.10

func (vm *VMClient) CrossChainAppRequestFailed(ctx context.Context, chainID ids.ID, requestID uint32, appErr *common.AppError) error

func (*VMClient) CrossChainAppResponse added in v1.11.10

func (vm *VMClient) CrossChainAppResponse(ctx context.Context, chainID ids.ID, requestID uint32, response []byte) error

func (*VMClient) Disconnected added in v1.11.10

func (vm *VMClient) Disconnected(ctx context.Context, nodeID ids.NodeID) error

func (*VMClient) Gather added in v1.11.10

func (vm *VMClient) Gather() ([]*dto.MetricFamily, error)

func (*VMClient) GetAncestors added in v1.11.10

func (vm *VMClient) GetAncestors(
	ctx context.Context,
	blkID ids.ID,
	maxBlocksNum int,
	maxBlocksSize int,
	maxBlocksRetrivalTime time.Duration,
) ([][]byte, error)

func (*VMClient) GetBlockIDAtHeight added in v1.11.10

func (vm *VMClient) GetBlockIDAtHeight(ctx context.Context, height uint64) (ids.ID, error)

func (*VMClient) GetLastStateSummary added in v1.11.10

func (vm *VMClient) GetLastStateSummary(ctx context.Context) (block.StateSummary, error)

func (*VMClient) GetOngoingSyncStateSummary added in v1.11.10

func (vm *VMClient) GetOngoingSyncStateSummary(ctx context.Context) (block.StateSummary, error)

func (*VMClient) GetStateSummary added in v1.11.10

func (vm *VMClient) GetStateSummary(ctx context.Context, summaryHeight uint64) (block.StateSummary, error)

func (*VMClient) HealthCheck added in v1.11.10

func (vm *VMClient) HealthCheck(ctx context.Context) (interface{}, error)

func (*VMClient) Initialize

func (vm *VMClient) Initialize(
	ctx context.Context,
	chainCtx *snow.Context,
	db database.Database,
	genesisBytes []byte,
	upgradeBytes []byte,
	configBytes []byte,
	toEngine chan<- common.Message,
	fxs []*common.Fx,
	appSender common.AppSender,
) error

func (*VMClient) ParseStateSummary added in v1.11.10

func (vm *VMClient) ParseStateSummary(ctx context.Context, summaryBytes []byte) (block.StateSummary, error)

func (*VMClient) SetPreference

func (vm *VMClient) SetPreference(ctx context.Context, blkID ids.ID) error

func (*VMClient) SetState added in v1.11.10

func (vm *VMClient) SetState(ctx context.Context, state snow.State) error

func (*VMClient) Shutdown

func (vm *VMClient) Shutdown(ctx context.Context) error

func (*VMClient) StateSyncEnabled added in v1.11.10

func (vm *VMClient) StateSyncEnabled(ctx context.Context) (bool, error)

func (*VMClient) Version added in v1.11.10

func (vm *VMClient) Version(ctx context.Context) (string, error)

type VMServer

type VMServer struct {
	vmpb.UnsafeVMServer
	// contains filtered or unexported fields
}

VMServer is a VM that is managed over RPC.

func NewServer

func NewServer(vm block.ChainVM, allowShutdown *utils.Atomic[bool]) *VMServer

NewServer returns a vm instance connected to a remote vm instance

func (*VMServer) AppGossip added in v1.11.10

func (vm *VMServer) AppGossip(ctx context.Context, req *vmpb.AppGossipMsg) (*emptypb.Empty, error)

func (*VMServer) AppRequest added in v1.11.10

func (vm *VMServer) AppRequest(ctx context.Context, req *vmpb.AppRequestMsg) (*emptypb.Empty, error)

func (*VMServer) AppRequestFailed added in v1.11.10

func (vm *VMServer) AppRequestFailed(ctx context.Context, req *vmpb.AppRequestFailedMsg) (*emptypb.Empty, error)

func (*VMServer) AppResponse added in v1.11.10

func (vm *VMServer) AppResponse(ctx context.Context, req *vmpb.AppResponseMsg) (*emptypb.Empty, error)

func (*VMServer) BatchedParseBlock added in v1.11.10

func (vm *VMServer) BatchedParseBlock(
	ctx context.Context,
	req *vmpb.BatchedParseBlockRequest,
) (*vmpb.BatchedParseBlockResponse, error)

func (*VMServer) BlockAccept

func (vm *VMServer) BlockAccept(ctx context.Context, req *vmpb.BlockAcceptRequest) (*emptypb.Empty, error)

func (*VMServer) BlockReject

func (vm *VMServer) BlockReject(ctx context.Context, req *vmpb.BlockRejectRequest) (*emptypb.Empty, error)

func (*VMServer) BlockVerify

func (*VMServer) BuildBlock

If the underlying VM doesn't actually implement this method, its [BuildBlock] method will be called instead.

func (*VMServer) Connected added in v1.11.10

func (vm *VMServer) Connected(ctx context.Context, req *vmpb.ConnectedRequest) (*emptypb.Empty, error)

func (*VMServer) CreateHandlers

func (vm *VMServer) CreateHandlers(ctx context.Context, _ *emptypb.Empty) (*vmpb.CreateHandlersResponse, error)

func (*VMServer) CrossChainAppRequest added in v1.11.10

func (vm *VMServer) CrossChainAppRequest(ctx context.Context, msg *vmpb.CrossChainAppRequestMsg) (*emptypb.Empty, error)

func (*VMServer) CrossChainAppRequestFailed added in v1.11.10

func (vm *VMServer) CrossChainAppRequestFailed(ctx context.Context, msg *vmpb.CrossChainAppRequestFailedMsg) (*emptypb.Empty, error)

func (*VMServer) CrossChainAppResponse added in v1.11.10

func (vm *VMServer) CrossChainAppResponse(ctx context.Context, msg *vmpb.CrossChainAppResponseMsg) (*emptypb.Empty, error)

func (*VMServer) Disconnected added in v1.11.10

func (vm *VMServer) Disconnected(ctx context.Context, req *vmpb.DisconnectedRequest) (*emptypb.Empty, error)

func (*VMServer) Gather added in v1.11.10

func (*VMServer) GetAncestors added in v1.11.10

func (*VMServer) GetBlock

func (vm *VMServer) GetBlock(ctx context.Context, req *vmpb.GetBlockRequest) (*vmpb.GetBlockResponse, error)

func (*VMServer) GetBlockIDAtHeight added in v1.11.10

func (*VMServer) GetLastStateSummary added in v1.11.10

func (vm *VMServer) GetLastStateSummary(ctx context.Context, _ *emptypb.Empty) (*vmpb.GetLastStateSummaryResponse, error)

func (*VMServer) GetOngoingSyncStateSummary added in v1.11.10

func (vm *VMServer) GetOngoingSyncStateSummary(
	ctx context.Context,
	_ *emptypb.Empty,
) (*vmpb.GetOngoingSyncStateSummaryResponse, error)

func (*VMServer) GetStateSummary added in v1.11.10

func (vm *VMServer) GetStateSummary(
	ctx context.Context,
	req *vmpb.GetStateSummaryRequest,
) (*vmpb.GetStateSummaryResponse, error)

func (*VMServer) Health added in v1.11.10

func (vm *VMServer) Health(ctx context.Context, _ *emptypb.Empty) (*vmpb.HealthResponse, error)

func (*VMServer) Initialize

func (*VMServer) ParseBlock

func (*VMServer) ParseStateSummary added in v1.11.10

func (vm *VMServer) ParseStateSummary(
	ctx context.Context,
	req *vmpb.ParseStateSummaryRequest,
) (*vmpb.ParseStateSummaryResponse, error)

func (*VMServer) SetPreference

func (vm *VMServer) SetPreference(ctx context.Context, req *vmpb.SetPreferenceRequest) (*emptypb.Empty, error)

func (*VMServer) SetState added in v1.11.10

func (vm *VMServer) SetState(ctx context.Context, stateReq *vmpb.SetStateRequest) (*vmpb.SetStateResponse, error)

func (*VMServer) Shutdown

func (vm *VMServer) Shutdown(ctx context.Context, _ *emptypb.Empty) (*emptypb.Empty, error)

func (*VMServer) StateSummaryAccept added in v1.11.10

func (*VMServer) StateSyncEnabled added in v1.11.10

func (vm *VMServer) StateSyncEnabled(ctx context.Context, _ *emptypb.Empty) (*vmpb.StateSyncEnabledResponse, error)

func (*VMServer) Version added in v1.11.10

func (vm *VMServer) Version(ctx context.Context, _ *emptypb.Empty) (*vmpb.VersionResponse, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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