registry

package
v0.2012.5 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2021 License: Apache-2.0 Imports: 21 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 (
	// CfgSupported configures a supported runtime ID.
	CfgSupported = "runtime.supported"

	// CfgHistoryPrunerStrategy configures the history pruner strategy.
	CfgHistoryPrunerStrategy = "runtime.history.pruner.strategy"
	// CfgHistoryPrunerInterval configures the history pruner interval.
	CfgHistoryPrunerInterval = "runtime.history.pruner.interval"
	// CfgHistoryPrunerKeepLastNum configures the number of last kept
	// rounds when using the "keep last" pruner strategy.
	CfgHistoryPrunerKeepLastNum = "runtime.history.pruner.num_kept"

	// CfgTagIndexerBackend configures the history tag indexer backend.
	CfgTagIndexerBackend = "runtime.history.tag_indexer.backend"
)
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"
)
View Source
const (
	// RuntimesDir is the name of the directory located inside the node's data
	// directory which contains the per-runtime state.
	RuntimesDir = "runtimes"
)

Variables

Flags has the configuration flags.

Functions

func EnsureRuntimeStateDir

func EnsureRuntimeStateDir(dataDir string, runtimeID common.Namespace) (string, error)

EnsureRuntimeStateDir ensures a specific per-runtime directory exists and returns its full path.

func ParseRuntimeMap

func ParseRuntimeMap(rawItems []string) (map[common.Namespace]string, error)

ParseRuntimeMap parses strings in the format of <runtime-id>[:<value>] and returns them as a map of runtime IDs to value.

Types

type Registry

type Registry interface {
	// GetRuntime returns the per-runtime interface if the runtime is supported.
	GetRuntime(runtimeID common.Namespace) (Runtime, error)

	// Runtimes returns a list of all supported runtimes.
	Runtimes() []Runtime

	// NewUnmanagedRuntime creates a new runtime that is not managed by this
	// registry.
	NewUnmanagedRuntime(ctx context.Context, runtimeID common.Namespace) (Runtime, error)

	// StorageRouter returns a storage backend which routes requests to the
	// correct per-runtime storage backend based on the namespace contained
	// in the request.
	StorageRouter() storageAPI.Backend

	// Cleanup performs post-termination cleanup.
	Cleanup()

	// FinishInitialization finalizes setup for all runtimes and starts their
	// tag indexers.
	FinishInitialization(ctx context.Context) error
}

Registry is the running node's runtime registry interface.

func New

func New(ctx context.Context, dataDir string, consensus consensus.Backend, identity *identity.Identity) (Registry, error)

New creates a new runtime registry.

type Runtime

type Runtime interface {
	// ID is the runtime identifier.
	ID() common.Namespace

	// 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)

	// RegisterStorage sets the given local storage backend for the runtime.
	RegisterStorage(storage storageAPI.Backend)

	// History returns the history for this runtime.
	History() history.History

	// TagIndexer returns the tag indexer backend.
	TagIndexer() tagindexer.QueryableBackend

	// 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 RuntimeConfig

type RuntimeConfig struct {
	// History configures the runtime history keeper.
	History history.Config

	// TagIndexer configures the tag indexer backend.
	TagIndexer tagindexer.BackendFactory
}

RuntimeConfig is a per-runtime config.

Jump to

Keyboard shortcuts

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