registry

package
v0.2506.0 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2025 License: Apache-2.0 Imports: 56 Imported by: 1

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

View Source
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

View Source
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 KeyManagerNotifier added in v0.2505.0

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

KeyManagerNotifier notifies compute runtimes about key manager status changes and quote policy updates.

func NewKeyManagerNotifier added in v0.2505.0

func NewKeyManagerNotifier(runtime Runtime, host *composite.Host, consensus consensus.Service, notifier *RuntimeHostNotifier) *KeyManagerNotifier

NewKeyManagerNotifier creates a new key manager notifier.

func (*KeyManagerNotifier) Name added in v0.2505.0

func (n *KeyManagerNotifier) Name() string

Name returns the name of the notifier.

func (*KeyManagerNotifier) Serve added in v0.2505.0

func (n *KeyManagerNotifier) Serve(ctx context.Context) error

Serve starts the notifier.

type LightBlockNotifier added in v0.2505.0

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

LightBlockNotifier notifies runtimes about new light blocks and periodically triggers re-attestation.

func NewLightBlockNotifier added in v0.2505.0

func NewLightBlockNotifier(runtime Runtime, host *composite.Host, consensus consensus.Service, notifier *RuntimeHostNotifier) *LightBlockNotifier

NewLightBlockNotifier creates a new light block notifier.

func (*LightBlockNotifier) Name added in v0.2505.0

func (n *LightBlockNotifier) Name() string

Name returns the name of the notifier.

func (*LightBlockNotifier) Serve added in v0.2505.0

func (n *LightBlockNotifier) Serve(ctx context.Context) error

Serve starts the notifier.

type Notification added in v0.2505.0

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

Notification is a notification to be sent to the component's queue.

type ROFLNotifier added in v0.2505.0

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

ROFLNotifier notifies ROFL components about new runtime blocks and events.

func NewROFLNotifier added in v0.2505.0

func NewROFLNotifier(runtime Runtime, host *composite.Host, consensus consensus.Service, notifier *RuntimeHostNotifier) *ROFLNotifier

NewROFLNotifier creates a new ROFL notifier.

func (*ROFLNotifier) Name added in v0.2505.0

func (n *ROFLNotifier) Name() string

Name returns the name of the notifier.

func (*ROFLNotifier) Serve added in v0.2505.0

func (n *ROFLNotifier) Serve(ctx context.Context) error

Serve starts the notifier.

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

	// GetLogManager returns the log manager.
	GetLogManager() *log.Manager
}

Registry is the running node's runtime registry interface.

func New

func New(
	dataDir string,
	consensus consensus.Service,
) (Registry, error)

New creates a new runtime registry.

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

	// GetROFLNotifier returns the ROFL notifier.
	GetROFLNotifier() (*ROFLNotifier, error)
}

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, logManager *log.Manager) (*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.

type RuntimeHostNotifier added in v0.2505.0

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

RuntimeHostNotifier delivers notifications to the components of the given host.

func NewRuntimeHostNotifier added in v0.2103.0

func NewRuntimeHostNotifier(host *composite.Host) *RuntimeHostNotifier

NewRuntimeHostNotifier creates a new runtime host notifier.

func (*RuntimeHostNotifier) Name added in v0.2505.0

func (n *RuntimeHostNotifier) Name() string

Name returns the name of the notifier.

func (*RuntimeHostNotifier) Queue added in v0.2505.0

func (n *RuntimeHostNotifier) Queue(nf *Notification) error

Queue queues a notification for dispatching to the target component.

func (*RuntimeHostNotifier) Serve added in v0.2505.0

func (n *RuntimeHostNotifier) Serve(ctx context.Context) error

Serve processes notifications from the queue and dispatches each to its corresponding component dispatcher.

Jump to

Keyboard shortcuts

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