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 EnsureRuntimeStateDir(dataDir string, runtimeID common.Namespace) (string, error)
- func GetRuntimeStateDir(dataDir string, runtimeID common.Namespace) string
- func NewRuntimeHostHandler(env RuntimeHostHandlerEnvironment, runtime Runtime, ...) host.RuntimeHandler
- func NewRuntimeHostNotifier(runtime Runtime, hostRt host.Runtime, consensus consensus.Backend) protocol.Notifier
- func ParseRuntimeMap(rawItems []string) (map[common.Namespace]string, error)
- type Registry
- type Runtime
- type RuntimeHostHandlerEnvironment
- type RuntimeHostHandlerFactory
- type RuntimeHostNode
- func (n *RuntimeHostNode) GetHostedRuntime() host.RichRuntime
- 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) GetRuntimeHostNotifier() protocol.Notifier
- func (n *RuntimeHostNode) ProvisionHostedRuntimeComponent(comp *bundle.ExplodedComponent) 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" )
const ( // RuntimesDir is the name of the directory located inside the node's data // directory which contains the per-runtime state. RuntimesDir = "runtimes" )
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 EnsureRuntimeStateDir ¶
EnsureRuntimeStateDir ensures a specific per-runtime directory exists and returns its full path.
func GetRuntimeStateDir ¶ added in v0.2100.0
func NewRuntimeHostHandler ¶ added in v0.2103.0
func NewRuntimeHostHandler( env RuntimeHostHandlerEnvironment, runtime Runtime, consensus consensus.Backend, ) 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 // NewRuntime creates a new runtime that may or may not be managed // by this registry. NewRuntime(ctx context.Context, runtimeID common.Namespace, managed bool) (Runtime, error) // 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 }
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 // HostProvisioner returns the runtime host provisioner when available. Otherwise returns nil. HostProvisioner() runtimeHost.Provisioner }
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) // GetLightClient returns the consensus light client. GetLightClient() (consensus.LightClient, error) // GetRuntimeRegistry returns the runtime registry. GetRuntimeRegistry() Registry }
RuntimeHostHandlerEnvironment is the host environment interface.
type RuntimeHostHandlerFactory ¶ added in v0.2100.0
type RuntimeHostHandlerFactory interface { // GetRuntime returns the registered runtime for which a runtime host handler is to be created. GetRuntime() Runtime // NewRuntimeHostHandler creates a new runtime host handler. NewRuntimeHostHandler() host.RuntimeHandler // NewRuntimeHostNotifier creates a new runtime host notifier. NewRuntimeHostNotifier(host host.Runtime) protocol.Notifier }
RuntimeHostHandlerFactory is an interface that can be used to create new runtime handlers and notifiers when provisioning hosted runtimes.
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(factory RuntimeHostHandlerFactory) (*RuntimeHostNode, error)
NewRuntimeHostNode creates a new runtime host node.
func (*RuntimeHostNode) GetHostedRuntime ¶ added in v0.2100.0
func (n *RuntimeHostNode) GetHostedRuntime() host.RichRuntime
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) GetRuntimeHostNotifier ¶ added in v0.2500.0
func (n *RuntimeHostNode) GetRuntimeHostNotifier() protocol.Notifier
GetRuntimeHostNotifier returns the runtime host notifier.
func (*RuntimeHostNode) ProvisionHostedRuntimeComponent ¶ added in v0.2500.0
func (n *RuntimeHostNode) ProvisionHostedRuntimeComponent(comp *bundle.ExplodedComponent) error
ProvisionHostedRuntimeComponent provisions the given runtime component.
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.