Documentation
¶
Overview ¶
Package registry provides a registry of runtimes supported by the running oasis-node. It serves as a central point of runtime configuration.
Index ¶
- Constants
- Variables
- func NewRuntimeHostHandler(env RuntimeHostHandlerEnvironment, runtime Runtime, ...) host.RuntimeHandler
- func NewRuntimeHostNotifier(runtime Runtime, host *composite.Host, consensus consensus.Service) protocol.Notifier
- type Registry
- type Runtime
- type RuntimeHostHandlerEnvironment
- type RuntimeHostNode
- func (n *RuntimeHostNode) GetHostedRuntime() *composite.Host
- func (n *RuntimeHostNode) GetHostedRuntimeActiveVersion() (*version.Version, error)
- func (n *RuntimeHostNode) GetHostedRuntimeCapabilityTEE() (*node.CapabilityTEE, error)
- func (n *RuntimeHostNode) GetHostedRuntimeCapabilityTEEForVersion(version version.Version) (*node.CapabilityTEE, error)
- func (n *RuntimeHostNode) ProvisionHostedRuntimeComponent(comp *bundle.ExplodedComponent) error
- func (n *RuntimeHostNode) RemoveHostedRuntimeComponent(id component.ID) error
- func (n *RuntimeHostNode) SetHostedRuntimeVersion(active *version.Version, next *version.Version)
Constants ¶
const ( // MaxRuntimeCount is the maximum number of runtimes that can be supported // by a single node. MaxRuntimeCount = 64 // LocalStorageFile is the filename of the worker's local storage database. LocalStorageFile = "worker-local-storage.badger.db" )
Variables ¶
var ErrRuntimeHostNotConfigured = errors.New("runtime/registry: runtime host not configured")
ErrRuntimeHostNotConfigured is the error returned when the runtime host is not configured for a specified runtime and a request is made to get the runtime host provisioner.
Functions ¶
func NewRuntimeHostHandler ¶ added in v0.2103.0
func NewRuntimeHostHandler( env RuntimeHostHandlerEnvironment, runtime Runtime, consensus consensus.Service, ) host.RuntimeHandler
NewRuntimeHostHandler returns a protocol handler that provides the required host methods for the runtime to interact with the outside world.
The passed identity may be nil.
Types ¶
type Registry ¶
type Registry interface {
service.BackgroundService
// GetRuntime returns the per-runtime interface.
GetRuntime(runtimeID common.Namespace) (Runtime, error)
// Runtimes returns a list of all runtimes.
Runtimes() []Runtime
// Indexer returns runtime history indexer for the specified runtime.
Indexer(runtimeID common.Namespace) (*history.BlockIndexer, bool)
// RegisterClient registers a runtime client service. If the service has already been registered
// this method returns an error.
RegisterClient(rc runtimeClient.RuntimeClient) error
// Client returns the runtime client service if available.
Client() (runtimeClient.RuntimeClient, error)
// FinishInitialization finalizes setup for all runtimes.
FinishInitialization() error
// GetBundleRegistry returns the bundle registry.
GetBundleRegistry() *bundle.Registry
// GetBundleManager returns the bundle manager.
GetBundleManager() *bundle.Manager
// GetVolumeManager returns the volume manager.
GetVolumeManager() *volume.Manager
}
Registry is the running node's runtime registry interface.
type Runtime ¶
type Runtime interface {
// ID is the runtime identifier.
ID() common.Namespace
// DataDir returns the runtime-specific data directory.
DataDir() string
// IsManaged returns true iff the runtime is managed by the registry.
IsManaged() bool
// RegistryDescriptor waits for the runtime to be registered and
// then returns its registry descriptor.
RegistryDescriptor(ctx context.Context) (*registry.Runtime, error)
// WatchRegistryDescriptor subscribes to registry descriptor updates.
WatchRegistryDescriptor() (<-chan *registry.Runtime, pubsub.ClosableSubscription, error)
// ActiveDescriptor waits for runtime to be initialized and then returns
// currently active runtime descriptor.
ActiveDescriptor(ctx context.Context) (*registry.Runtime, error)
// WatchActiveDescriptor subscribes to runtime active descriptor updates.
WatchActiveDescriptor() (<-chan *registry.Runtime, pubsub.ClosableSubscription, error)
// RegisterStorage sets the given local storage backend for the runtime.
RegisterStorage(storage storageAPI.Backend)
// History returns the history for this runtime.
History() history.History
// Storage returns the per-runtime storage backend.
Storage() storageAPI.Backend
// LocalStorage returns the per-runtime local storage.
LocalStorage() localstorage.LocalStorage
}
Runtime is the running node's supported runtime interface.
type RuntimeHostHandlerEnvironment ¶ added in v0.2103.0
type RuntimeHostHandlerEnvironment interface {
// GetKeyManagerClient returns the key manager client for this runtime.
GetKeyManagerClient() (runtimeKeymanager.Client, error)
// GetTxPool returns the transaction pool for this runtime.
GetTxPool() (txpool.TransactionPool, error)
// GetNodeIdentity returns the identity of a node running this runtime.
GetNodeIdentity() (*identity.Identity, error)
// GetLightProvider returns the consensus light provider.
GetLightProvider() (consensus.LightProvider, error)
// GetRuntimeRegistry returns the runtime registry.
GetRuntimeRegistry() Registry
}
RuntimeHostHandlerEnvironment is the host environment interface.
type RuntimeHostNode ¶ added in v0.2100.0
type RuntimeHostNode struct {
// contains filtered or unexported fields
}
RuntimeHostNode provides methods for nodes that need to host runtimes.
func NewRuntimeHostNode ¶ added in v0.2100.0
func NewRuntimeHostNode(runtime Runtime, provisioner host.Provisioner, handler host.RuntimeHandler) (*RuntimeHostNode, error)
NewRuntimeHostNode creates a new runtime host node.
func (*RuntimeHostNode) GetHostedRuntime ¶ added in v0.2100.0
func (n *RuntimeHostNode) GetHostedRuntime() *composite.Host
GetHostedRuntime returns the hosted runtime.
func (*RuntimeHostNode) GetHostedRuntimeActiveVersion ¶ added in v0.2400.0
func (n *RuntimeHostNode) GetHostedRuntimeActiveVersion() (*version.Version, error)
GetHostedRuntimeActiveVersion returns the version of the active runtime.
func (*RuntimeHostNode) GetHostedRuntimeCapabilityTEE ¶ added in v0.2300.0
func (n *RuntimeHostNode) GetHostedRuntimeCapabilityTEE() (*node.CapabilityTEE, error)
GetHostedRuntimeCapabilityTEE returns the CapabilityTEE for the active runtime version.
It may be nil in case the CapabilityTEE is not available or if the runtime is not running inside a TEE.
func (*RuntimeHostNode) GetHostedRuntimeCapabilityTEEForVersion ¶ added in v0.2400.0
func (n *RuntimeHostNode) GetHostedRuntimeCapabilityTEEForVersion(version version.Version) (*node.CapabilityTEE, error)
GetHostedRuntimeCapabilityTEEForVersion returns the CapabilityTEE for a specific runtime version.
It may be nil in case the CapabilityTEE is not available or if the runtime is not running inside a TEE.
func (*RuntimeHostNode) ProvisionHostedRuntimeComponent ¶ added in v0.2500.0
func (n *RuntimeHostNode) ProvisionHostedRuntimeComponent(comp *bundle.ExplodedComponent) error
ProvisionHostedRuntimeComponent provisions the given runtime component.
func (*RuntimeHostNode) RemoveHostedRuntimeComponent ¶ added in v0.2502.0
func (n *RuntimeHostNode) RemoveHostedRuntimeComponent(id component.ID) error
RemoveHostedRuntimeComponent removes the given runtime component.
Attempting to remove the RONL component will result in an error.
func (*RuntimeHostNode) SetHostedRuntimeVersion ¶ added in v0.2200.0
func (n *RuntimeHostNode) SetHostedRuntimeVersion(active *version.Version, next *version.Version)
SetHostedRuntimeVersion sets the currently active and next versions for the hosted runtime.