Documentation
¶
Index ¶
- func NewFactory(path string, processTracker resource.ProcessTracker, ...) vms.Factory
- func Serve(ctx context.Context, log log.Logger, vm block.ChainVM, ...) error
- type BCLookup
- type Context
- type GetCurrentValidatorOutput
- type Message
- type NotificationForwarder
- type Notifier
- type SharedMemory
- type Subscription
- type VMClient
- func (vm *VMClient) AppGossip(ctx context.Context, nodeID ids.NodeID, msg []byte) error
- func (vm *VMClient) AppRequest(ctx context.Context, nodeID ids.NodeID, requestID uint32, deadline time.Time, ...) error
- func (vm *VMClient) AppRequestFailed(ctx context.Context, nodeID ids.NodeID, requestID uint32, appErr *warp.Error) error
- func (vm *VMClient) AppResponse(ctx context.Context, nodeID ids.NodeID, requestID uint32, response []byte) error
- func (vm *VMClient) BatchedParseBlock(ctx context.Context, blks [][]byte) ([]chainblock.Block, error)
- func (vm *VMClient) BuildBlock(ctx context.Context) (chainblock.Block, error)
- func (vm *VMClient) BuildBlockWithContext(ctx context.Context, blockCtx *chainblock.Context) (chainblock.Block, error)
- func (vm *VMClient) Connected(ctx context.Context, nodeID ids.NodeID, nodeVersion interface{}) error
- func (vm *VMClient) CreateHandlers(ctx context.Context) (map[string]http.Handler, error)
- func (vm *VMClient) Disconnected(ctx context.Context, nodeID ids.NodeID) error
- func (vm *VMClient) Gather() ([]*dto.MetricFamily, error)
- func (vm *VMClient) GetAncestors(ctx context.Context, blkID ids.ID, maxBlocksNum int, maxBlocksSize int, ...) ([][]byte, error)
- func (vm *VMClient) GetBlock(ctx context.Context, id ids.ID) (chainblock.Block, error)
- func (vm *VMClient) GetBlockIDAtHeight(ctx context.Context, height uint64) (ids.ID, error)
- func (vm *VMClient) GetChainID(ctx context.Context) (ids.ID, error)
- func (vm *VMClient) GetLastStateSummary(ctx context.Context) (chainblock.StateSummary, error)
- func (vm *VMClient) GetOngoingSyncStateSummary(ctx context.Context) (chainblock.StateSummary, error)
- func (vm *VMClient) GetStateSummary(ctx context.Context, summaryHeight uint64) (chainblock.StateSummary, error)
- func (vm *VMClient) HealthCheck(ctx context.Context) (interface{}, error)
- func (vm *VMClient) Initialize(ctx context.Context, chainCtxIface interface{}, dbIface interface{}, ...) error
- func (vm *VMClient) LastAccepted(ctx context.Context) (ids.ID, error)
- func (vm *VMClient) NewHTTPHandler(ctx context.Context) (interface{}, error)
- func (vm *VMClient) ParseBlock(ctx context.Context, bytes []byte) (chainblock.Block, error)
- func (vm *VMClient) ParseStateSummary(ctx context.Context, summaryBytes []byte) (chainblock.StateSummary, error)
- func (vm *VMClient) SetPreference(ctx context.Context, blkID ids.ID) error
- func (vm *VMClient) SetState(ctx context.Context, state uint32) error
- func (vm *VMClient) Shutdown(ctx context.Context) error
- func (vm *VMClient) StateSyncEnabled(ctx context.Context) (bool, error)
- func (vm *VMClient) Version(ctx context.Context) (string, error)
- func (vm *VMClient) WaitForEvent(ctx context.Context) (interface{}, error)
- type VMServer
- func (vm *VMServer) AppGossip(ctx context.Context, req *vmpb.AppGossipMsg) (*emptypb.Empty, error)
- func (vm *VMServer) AppRequest(ctx context.Context, req *vmpb.AppRequestMsg) (*emptypb.Empty, error)
- func (vm *VMServer) AppRequestFailed(ctx context.Context, req *vmpb.AppRequestFailedMsg) (*emptypb.Empty, error)
- func (vm *VMServer) AppResponse(ctx context.Context, req *vmpb.AppResponseMsg) (*emptypb.Empty, error)
- func (vm *VMServer) BatchedParseBlock(ctx context.Context, req *vmpb.BatchedParseBlockRequest) (*vmpb.BatchedParseBlockResponse, error)
- func (vm *VMServer) BlockAccept(ctx context.Context, req *vmpb.BlockAcceptRequest) (*emptypb.Empty, error)
- func (vm *VMServer) BlockReject(ctx context.Context, req *vmpb.BlockRejectRequest) (*emptypb.Empty, error)
- func (vm *VMServer) BlockVerify(ctx context.Context, req *vmpb.BlockVerifyRequest) (*vmpb.BlockVerifyResponse, error)
- func (vm *VMServer) BuildBlock(ctx context.Context, req *vmpb.BuildBlockRequest) (*vmpb.BuildBlockResponse, error)
- func (vm *VMServer) Connected(ctx context.Context, req *vmpb.ConnectedRequest) (*emptypb.Empty, error)
- func (vm *VMServer) CreateHandlers(ctx context.Context, _ *emptypb.Empty) (*vmpb.CreateHandlersResponse, error)
- func (vm *VMServer) Disconnected(ctx context.Context, req *vmpb.DisconnectedRequest) (*emptypb.Empty, error)
- func (vm *VMServer) Gather(context.Context, *emptypb.Empty) (*vmpb.GatherResponse, error)
- func (vm *VMServer) GetAncestors(ctx context.Context, req *vmpb.GetAncestorsRequest) (*vmpb.GetAncestorsResponse, error)
- func (vm *VMServer) GetBlock(ctx context.Context, req *vmpb.GetBlockRequest) (*vmpb.GetBlockResponse, error)
- func (vm *VMServer) GetBlockIDAtHeight(ctx context.Context, req *vmpb.GetBlockIDAtHeightRequest) (*vmpb.GetBlockIDAtHeightResponse, error)
- func (vm *VMServer) GetLastStateSummary(ctx context.Context, _ *emptypb.Empty) (*vmpb.GetLastStateSummaryResponse, error)
- func (vm *VMServer) GetOngoingSyncStateSummary(ctx context.Context, _ *emptypb.Empty) (*vmpb.GetOngoingSyncStateSummaryResponse, error)
- func (vm *VMServer) GetStateSummary(ctx context.Context, req *vmpb.GetStateSummaryRequest) (*vmpb.GetStateSummaryResponse, error)
- func (vm *VMServer) Health(ctx context.Context, _ *emptypb.Empty) (*vmpb.HealthResponse, error)
- func (vm *VMServer) Initialize(ctx context.Context, req *vmpb.InitializeRequest) (*vmpb.InitializeResponse, error)
- func (vm *VMServer) NewHTTPHandler(ctx context.Context, _ *emptypb.Empty) (*vmpb.NewHTTPHandlerResponse, error)
- func (vm *VMServer) ParseBlock(ctx context.Context, req *vmpb.ParseBlockRequest) (*vmpb.ParseBlockResponse, error)
- func (vm *VMServer) ParseStateSummary(ctx context.Context, req *vmpb.ParseStateSummaryRequest) (*vmpb.ParseStateSummaryResponse, error)
- func (vm *VMServer) SetPreference(ctx context.Context, req *vmpb.SetPreferenceRequest) (*emptypb.Empty, error)
- func (vm *VMServer) SetState(ctx context.Context, stateReq *vmpb.SetStateRequest) (*vmpb.SetStateResponse, error)
- func (vm *VMServer) Shutdown(ctx context.Context, _ *emptypb.Empty) (*emptypb.Empty, error)
- func (vm *VMServer) StateSummaryAccept(ctx context.Context, req *vmpb.StateSummaryAcceptRequest) (*vmpb.StateSummaryAcceptResponse, error)
- func (vm *VMServer) StateSyncEnabled(ctx context.Context, _ *emptypb.Empty) (*vmpb.StateSyncEnabledResponse, error)
- func (vm *VMServer) Version(ctx context.Context, _ *emptypb.Empty) (*vmpb.VersionResponse, error)
- func (vm *VMServer) WaitForEvent(ctx context.Context, _ *emptypb.Empty) (*vmpb.WaitForEventResponse, error)
- type ValidatorState
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewFactory ¶ added in v0.1.1
func NewFactory( path string, processTracker resource.ProcessTracker, runtimeTracker runtime.Tracker, metricsGatherer metric.MultiGatherer, ) vms.Factory
func Serve ¶ added in v0.1.1
func Serve(ctx context.Context, log log.Logger, 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 Context ¶ added in v1.16.56
type Context struct {
NetworkID uint32
NetID ids.ID
ChainID ids.ID
NodeID ids.NodeID
PublicKey *bls.PublicKey
NetworkUpgrades upgrade.Config
XChainID ids.ID
CChainID ids.ID
LUXAssetID ids.ID
ChainDataDir string
Log log.Logger
BCLookup ids.AliaserReader
Metrics metrics.MultiGatherer
WarpSigner warp.Signer
ValidatorState validators.State
}
Context is the node-specific context for RPC chain VM
func (*Context) PublicKeyBytes ¶ added in v1.16.56
PublicKeyBytes returns the public key as bytes
func (*Context) ToConsensusContext ¶ added in v1.16.56
func (c *Context) ToConsensusContext() interface{}
ToConsensusContext converts node Context to consensus Context This is explicit - we know exactly what we're doing
type GetCurrentValidatorOutput ¶ added in v1.16.56
GetCurrentValidatorOutput represents a current validator
type Message ¶ added in v1.16.56
type Message uint32
Message represents a notification message type
const (
// PendingTxs indicates pending transactions notification
PendingTxs Message
)
type NotificationForwarder ¶ added in v1.16.56
type NotificationForwarder struct {
Engine Notifier
Subscribe Subscription
Log log.Logger
// contains filtered or unexported fields
}
NotificationForwarder is a component that listens for notifications from a Subscription, and forwards them to a Notifier. When CheckForEvent is called mid-subscription, it retries the subscription. After Notify is called, it waits for CheckForEvent to be called before subscribing again.
func NewNotificationForwarder ¶ added in v1.16.56
func NewNotificationForwarder( engine Notifier, subscribe Subscription, log log.Logger, ) *NotificationForwarder
func (*NotificationForwarder) CheckForEvent ¶ added in v1.16.56
func (nf *NotificationForwarder) CheckForEvent()
CheckForEvent cancels any outstanding WaitForEvent calls and schedules a new WaitForEvent call.
func (*NotificationForwarder) Close ¶ added in v1.16.56
func (nf *NotificationForwarder) Close()
Close cancels any outstanding WaitForEvent calls and waits for them to return. After Close returns, no future WaitForEvent calls will be made by the notification forwarder.
type SharedMemory ¶ added in v1.16.56
type SharedMemory interface {
}
Define missing interfaces locally
type Subscription ¶ added in v1.16.56
Subscription is a function that blocks until either the given context is cancelled, or a message is returned. It is used to receive messages from a VM such as Pending transactions, state sync completion, etc. The function returns the message received, or an error if the context is cancelled.
type VMClient ¶
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, logger log.Logger, ) *VMClient
NewClient returns a VM connected to a remote VM
func (*VMClient) AppRequest ¶ added in v0.1.1
func (*VMClient) AppRequestFailed ¶ added in v0.1.1
func (*VMClient) AppResponse ¶ added in v0.1.1
func (*VMClient) BatchedParseBlock ¶ added in v1.11.14
func (vm *VMClient) BatchedParseBlock(ctx context.Context, blks [][]byte) ([]chainblock.Block, error)
BatchedParseBlock implements the block.BatchedChainVM interface
func (*VMClient) BuildBlock ¶
BuildBlock implements the block.ChainVM interface
func (*VMClient) BuildBlockWithContext ¶ added in v1.11.14
func (vm *VMClient) BuildBlockWithContext(ctx context.Context, blockCtx *chainblock.Context) (chainblock.Block, error)
BuildBlockWithContext implements the block.BuildBlockWithContextChainVM interface
func (*VMClient) CreateHandlers ¶
func (*VMClient) Disconnected ¶ added in v0.1.1
func (*VMClient) GetAncestors ¶ added in v0.1.1
func (*VMClient) GetBlockIDAtHeight ¶ added in v0.1.1
func (*VMClient) GetChainID ¶ added in v1.16.56
GetChainID implements block.ChainVM.
func (*VMClient) GetLastStateSummary ¶ added in v0.1.1
func (vm *VMClient) GetLastStateSummary(ctx context.Context) (chainblock.StateSummary, error)
func (*VMClient) GetOngoingSyncStateSummary ¶ added in v0.1.1
func (vm *VMClient) GetOngoingSyncStateSummary(ctx context.Context) (chainblock.StateSummary, error)
func (*VMClient) GetStateSummary ¶ added in v0.1.1
func (vm *VMClient) GetStateSummary(ctx context.Context, summaryHeight uint64) (chainblock.StateSummary, error)
func (*VMClient) HealthCheck ¶ added in v0.1.1
func (*VMClient) Initialize ¶
func (*VMClient) LastAccepted ¶
LastAccepted implements the block.ChainVM interface
func (*VMClient) NewHTTPHandler ¶ added in v0.1.1
NewHTTPHandler implements the VM interface
func (*VMClient) ParseBlock ¶
ParseBlock implements the block.ChainVM interface
func (*VMClient) ParseStateSummary ¶ added in v0.1.1
func (vm *VMClient) ParseStateSummary(ctx context.Context, summaryBytes []byte) (chainblock.StateSummary, error)
func (*VMClient) SetPreference ¶
func (*VMClient) StateSyncEnabled ¶ added in v0.1.1
type VMServer ¶
type VMServer struct {
vmpb.UnsafeVMServer
// contains filtered or unexported fields
}
VMServer is a VM that is managed over RPC.
func (*VMServer) AppRequest ¶ added in v0.1.1
func (*VMServer) AppRequestFailed ¶ added in v0.1.1
func (*VMServer) AppResponse ¶ added in v0.1.1
func (*VMServer) BatchedParseBlock ¶ added in v0.1.1
func (vm *VMServer) BatchedParseBlock( ctx context.Context, req *vmpb.BatchedParseBlockRequest, ) (*vmpb.BatchedParseBlockResponse, error)
func (*VMServer) BlockAccept ¶
func (*VMServer) BlockReject ¶
func (*VMServer) BlockVerify ¶
func (vm *VMServer) BlockVerify(ctx context.Context, req *vmpb.BlockVerifyRequest) (*vmpb.BlockVerifyResponse, error)
func (*VMServer) BuildBlock ¶
func (vm *VMServer) BuildBlock(ctx context.Context, req *vmpb.BuildBlockRequest) (*vmpb.BuildBlockResponse, error)
If the underlying VM doesn't actually implement this method, its [BuildBlock] method will be called instead.
func (*VMServer) CreateHandlers ¶
func (*VMServer) Disconnected ¶ added in v0.1.1
func (*VMServer) GetAncestors ¶ added in v0.1.1
func (vm *VMServer) GetAncestors(ctx context.Context, req *vmpb.GetAncestorsRequest) (*vmpb.GetAncestorsResponse, error)
func (*VMServer) GetBlock ¶
func (vm *VMServer) GetBlock(ctx context.Context, req *vmpb.GetBlockRequest) (*vmpb.GetBlockResponse, error)
func (*VMServer) GetBlockIDAtHeight ¶ added in v0.1.1
func (vm *VMServer) GetBlockIDAtHeight( ctx context.Context, req *vmpb.GetBlockIDAtHeightRequest, ) (*vmpb.GetBlockIDAtHeightResponse, error)
func (*VMServer) GetLastStateSummary ¶ added in v0.1.1
func (*VMServer) GetOngoingSyncStateSummary ¶ added in v0.1.1
func (*VMServer) GetStateSummary ¶ added in v0.1.1
func (vm *VMServer) GetStateSummary( ctx context.Context, req *vmpb.GetStateSummaryRequest, ) (*vmpb.GetStateSummaryResponse, error)
func (*VMServer) Initialize ¶
func (vm *VMServer) Initialize(ctx context.Context, req *vmpb.InitializeRequest) (*vmpb.InitializeResponse, error)
func (*VMServer) NewHTTPHandler ¶ added in v0.1.1
func (*VMServer) ParseBlock ¶
func (vm *VMServer) ParseBlock(ctx context.Context, req *vmpb.ParseBlockRequest) (*vmpb.ParseBlockResponse, error)
func (*VMServer) ParseStateSummary ¶ added in v0.1.1
func (vm *VMServer) ParseStateSummary( ctx context.Context, req *vmpb.ParseStateSummaryRequest, ) (*vmpb.ParseStateSummaryResponse, error)
func (*VMServer) SetPreference ¶
func (*VMServer) SetState ¶ added in v0.1.1
func (vm *VMServer) SetState(ctx context.Context, stateReq *vmpb.SetStateRequest) (*vmpb.SetStateResponse, error)
func (*VMServer) StateSummaryAccept ¶ added in v0.1.1
func (vm *VMServer) StateSummaryAccept( ctx context.Context, req *vmpb.StateSummaryAcceptRequest, ) (*vmpb.StateSummaryAcceptResponse, error)
func (*VMServer) StateSyncEnabled ¶ added in v0.1.1
func (*VMServer) WaitForEvent ¶ added in v0.1.1
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package commonmock is a generated GoMock package.
|
Package commonmock is a generated GoMock package. |