mirror of
https://github.com/luxfi/vm.git
synced 2026-10-30 15:13:40 +00:00
luxd v1.26+ sets the unprefixed VM_RUNTIME_ENGINE_ADDR and VM_TRANSPORT
env vars when launching plugin VMs. The historical LUX_VM_RUNTIME_ENGINE_ADDR
and LUX_VM_TRANSPORT names came from a now-dropped luxd<->plugin compatibility
shim — the canonical names are the unprefixed ones.
Renames:
- rpc/runtime/runtime.go: EngineAddressKey constant
- rpc/factory_zap.go: LUX_VM_TRANSPORT -> VM_TRANSPORT
- rpc/runtime/README.md: documentation aligned with code
Plugins built against luxfi/vm <= v1.1.0 read the LUX_-prefixed names and
will fail handshake against post-v1.1.1 luxd. Those plugins must rebuild
against this release.
Cleanup:
- drop dead xsvm protobuf+connect tree (no callers; xsvm has been on ZAP
since v1.0.41)
- drop indirect ringtail dep (consensus moved to corona+pulsar in v1.0.41+)
- .gitignore: ignore .DS_Store at every level
52 lines
1.4 KiB
Go
52 lines
1.4 KiB
Go
// Copyright (C) 2019-2025, Lux Industries, Inc. All rights reserved.
|
|
// See the file LICENSE for licensing terms.
|
|
|
|
package runtime
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
"time"
|
|
)
|
|
|
|
const (
|
|
// Address of the runtime engine server.
|
|
EngineAddressKey = "VM_RUNTIME_ENGINE_ADDR"
|
|
|
|
// Duration before handshake timeout during bootstrap.
|
|
DefaultHandshakeTimeout = 5 * time.Second
|
|
|
|
// Duration of time to wait for graceful termination to complete.
|
|
DefaultGracefulTimeout = 5 * time.Second
|
|
)
|
|
|
|
var (
|
|
ErrProtocolVersionMismatch = errors.New("RPCChainVM protocol version mismatch between Lux Node and Virtual Machine plugin")
|
|
ErrHandshakeFailed = errors.New("handshake failed")
|
|
ErrInvalidConfig = errors.New("invalid config")
|
|
ErrProcessNotFound = errors.New("vm process not found")
|
|
)
|
|
|
|
type Initializer interface {
|
|
// Initialize provides Lux Node with compatibility, networking and
|
|
// process information of a VM.
|
|
Initialize(ctx context.Context, protocolVersion uint, vmAddr string) error
|
|
}
|
|
|
|
type Stopper interface {
|
|
// Stop begins shutdown of a VM. This method must not block
|
|
// and multiple calls to this method will result in no-op.
|
|
Stop(ctx context.Context)
|
|
}
|
|
|
|
type Tracker interface {
|
|
// TrackRuntime adds a VM stopper to the manager.
|
|
TrackRuntime(runtime Stopper)
|
|
}
|
|
|
|
type Manager interface {
|
|
Tracker
|
|
// Stop all managed VMs.
|
|
Stop(ctx context.Context)
|
|
}
|