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 ¶
View Source
var Flags = flag.NewFlagSet("", flag.ContinueOnError)
Flags has the configuration flags.
Functions ¶
func EnsureRuntimeStateDir ¶
EnsureRuntimeStateDir ensures a specific per-runtime directory exists and returns its full path.
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()
}
Registry is the running node's runtime registry interface.
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)
// 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.
Click to show internal directories.
Click to hide internal directories.