rpcchainvm

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2022 License: BSD-3-Clause Imports: 50 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Handshake = plugin.HandshakeConfig{
	ProtocolVersion:  10,
	MagicCookieKey:   "VM_PLUGIN",
	MagicCookieValue: "dynamic",
}

Handshake is a common handshake that is shared by plugin and host.

View Source
var PluginMap = map[string]plugin.Plugin{
	"vm": &Plugin{},
}

PluginMap is the map of plugins we can dispense.

Functions

func RegisterPlugins added in v0.4.0

func RegisterPlugins(pluginDir string, manager vms.Manager) error

RegisterPlugins iterates over a given plugin dir and registers rpcchain VMs for each of the discovered plugins.

Types

type BlockClient

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

BlockClient is an implementation of Block that talks over RPC.

func (*BlockClient) Accept

func (b *BlockClient) Accept() error

func (*BlockClient) Bytes

func (b *BlockClient) Bytes() []byte

func (*BlockClient) Height

func (b *BlockClient) Height() uint64

func (*BlockClient) ID

func (b *BlockClient) ID() ids.ID

func (*BlockClient) Parent

func (b *BlockClient) Parent() ids.ID

func (*BlockClient) Reject

func (b *BlockClient) Reject() error

func (*BlockClient) Status

func (b *BlockClient) Status() choices.Status

func (*BlockClient) Timestamp added in v0.2.3

func (b *BlockClient) Timestamp() time.Time

func (*BlockClient) Verify

func (b *BlockClient) Verify() error

type Factory

type Factory struct {
	Path string
}

func (*Factory) New

func (f *Factory) New(ctx *snow.Context) (interface{}, error)

type Plugin

type Plugin struct {
	plugin.NetRPCUnsupportedPlugin
	// contains filtered or unexported fields
}

Plugin is the implementation of plugin.Plugin so we can serve/consume this. We also implement GRPCPlugin so that this plugin can be served over gRPC.

func New

func New(vm block.ChainVM) *Plugin

New creates a new plugin from the provided VM

func (*Plugin) GRPCClient

func (p *Plugin) GRPCClient(ctx context.Context, broker *plugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error)

GRPCClient returns a new GRPC client

func (*Plugin) GRPCServer

func (p *Plugin) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Server) error

GRPCServer registers a new GRPC server.

type VMClient

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

VMClient is an implementation of VM that talks over RPC.

func NewClient

func NewClient(client vmproto.VMClient, broker *plugin.GRPCBroker) *VMClient

NewClient returns a VM connected to a remote VM

func (*VMClient) AppGossip added in v0.2.3

func (vm *VMClient) AppGossip(nodeID ids.ShortID, msg []byte) error

func (*VMClient) AppRequest added in v0.2.3

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

func (*VMClient) AppRequestFailed added in v0.2.3

func (vm *VMClient) AppRequestFailed(nodeID ids.ShortID, requestID uint32) error

func (*VMClient) AppResponse added in v0.2.3

func (vm *VMClient) AppResponse(nodeID ids.ShortID, requestID uint32, response []byte) error

func (*VMClient) BatchedParseBlock added in v0.2.3

func (vm *VMClient) BatchedParseBlock(blksBytes [][]byte) ([]snowman.Block, error)

func (*VMClient) Connected

func (vm *VMClient) Connected(nodeID ids.ShortID, nodeVersion version.Application) error

func (*VMClient) CreateHandlers

func (vm *VMClient) CreateHandlers() (map[string]*common.HTTPHandler, error)

func (*VMClient) CreateStaticHandlers

func (vm *VMClient) CreateStaticHandlers() (map[string]*common.HTTPHandler, error)

func (*VMClient) Disconnected

func (vm *VMClient) Disconnected(nodeID ids.ShortID) error

func (*VMClient) Gather added in v0.4.0

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

func (*VMClient) GetAncestors added in v0.2.3

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

func (*VMClient) GetBlockIDAtHeight added in v0.5.1

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

func (*VMClient) HealthCheck

func (vm *VMClient) HealthCheck() (interface{}, error)

func (*VMClient) Initialize

func (vm *VMClient) Initialize(
	ctx *snow.Context,
	dbManager manager.Manager,
	genesisBytes []byte,
	upgradeBytes []byte,
	configBytes []byte,
	toEngine chan<- common.Message,
	fxs []*common.Fx,
	appSender common.AppSender,
) error

func (*VMClient) SetPreference

func (vm *VMClient) SetPreference(id ids.ID) error

func (*VMClient) SetProcess

func (vm *VMClient) SetProcess(proc *plugin.Client)

SetProcess gives ownership of the server process to the client.

func (*VMClient) SetState added in v0.5.1

func (vm *VMClient) SetState(state snow.State) error

func (*VMClient) Shutdown

func (vm *VMClient) Shutdown() error

func (*VMClient) VerifyHeightIndex added in v0.5.1

func (vm *VMClient) VerifyHeightIndex() error

func (*VMClient) Version

func (vm *VMClient) Version() (string, error)

type VMServer

type VMServer struct {
	vmproto.UnimplementedVMServer
	// contains filtered or unexported fields
}

VMServer is a VM that is managed over RPC.

func NewServer

func NewServer(vm block.ChainVM, broker *plugin.GRPCBroker) *VMServer

NewServer returns a vm instance connected to a remote vm instance

func (*VMServer) AppGossip added in v0.2.3

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

func (*VMServer) AppRequest added in v0.2.3

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

func (*VMServer) AppRequestFailed added in v0.2.3

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

func (*VMServer) AppResponse added in v0.2.3

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

func (*VMServer) BatchedParseBlock added in v0.2.3

func (*VMServer) BlockAccept

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

func (*VMServer) BlockReject

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

func (*VMServer) BlockVerify

func (*VMServer) BuildBlock

func (*VMServer) Connected added in v0.2.3

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

func (*VMServer) CreateHandlers

func (*VMServer) CreateStaticHandlers

func (*VMServer) Disconnected added in v0.2.3

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

func (*VMServer) Gather added in v0.4.0

func (*VMServer) GetAncestors added in v0.2.3

func (*VMServer) GetBlock

func (*VMServer) GetBlockIDAtHeight added in v0.5.1

func (*VMServer) Health

func (*VMServer) Initialize

func (*VMServer) ParseBlock

func (*VMServer) SetPreference

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

func (*VMServer) SetState added in v0.5.1

func (vm *VMServer) SetState(_ context.Context, stateReq *vmproto.SetStateRequest) (*emptypb.Empty, error)

func (*VMServer) Shutdown

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

func (*VMServer) VerifyHeightIndex added in v0.5.1

func (*VMServer) Version

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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