Documentation ¶
Index ¶
- Constants
- Variables
- type Config
- type RuntimeHostConfig
- type RuntimeHostHandlerFactory
- type RuntimeHostNode
- type Worker
- func (w *Worker) Cleanup()
- func (w *Worker) Enabled() bool
- func (w *Worker) GetConfig() Config
- func (w *Worker) GetRuntime(id common.Namespace) *committee.Node
- func (w *Worker) GetRuntimes() map[common.Namespace]*committee.Node
- func (w *Worker) Initialized() <-chan struct{}
- func (w *Worker) Name() string
- func (w *Worker) NewUnmanagedCommitteeNode(runtime runtimeRegistry.Runtime, enableP2P bool) (*committee.Node, error)
- func (w *Worker) Quit() <-chan struct{}
- func (w *Worker) Start() error
- func (w *Worker) Stop()
Constants ¶
const ( // RuntimeProvisionerMock is the name of the mock runtime provisioner. // // Use of this provisioner is only allowed if DebugDontBlameOasis flag is set. RuntimeProvisionerMock = "mock" // RuntimeProvisionerUnconfined is the name of the unconfined runtime provisioner that executes // runtimes as regular processes without any sandboxing. // // Use of this provisioner is only allowed if DebugDontBlameOasis flag is set. RuntimeProvisionerUnconfined = "unconfined" // RuntimeProvisionerSandboxed is the name of the sandboxed runtime provisioner that executes // runtimes as regular processes in a Linux namespaces/cgroups/SECCOMP sandbox. RuntimeProvisionerSandboxed = "sandboxed" )
Variables ¶
var ( // CfgClientPort configures the worker client port. CfgClientPort = "worker.client.port" // CfgSentryAddresses configures addresses and public keys of sentry nodes the worker should // connect to. CfgSentryAddresses = "worker.sentry.address" // CfgRuntimeProvisioner configures the runtime provisioner. CfgRuntimeProvisioner = "worker.runtime.provisioner" // CfgRuntimeSGXLoader configures the runtime loader binary required for SGX runtimes. A single // loader is used for all runtimes. CfgRuntimeSGXLoader = "worker.runtime.sgx.loader" // CfgRuntimePaths confgures the paths for supported runtimes. The value should be a map of // runtime IDs to corresponding resource paths (type of the resource depends on the // provisioner). CfgRuntimePaths = "worker.runtime.paths" // CfgRuntimeSGXSignatures configures signatures for supported runtimes. // The value should be a map of runtime IDs to corresponding resource // paths. CfgRuntimeSGXSignatures = "worker.runtime.sgx.signatures" // Flags has the configuration flags. Flags = flag.NewFlagSet("", flag.ContinueOnError) )
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { ClientPort uint16 ClientAddresses []node.Address SentryAddresses []node.TLSAddress // RuntimeHost contains configuration for a worker that hosts runtimes. It may be nil if the // worker is not configured to host runtimes. RuntimeHost *RuntimeHostConfig StorageCommitTimeout time.Duration // contains filtered or unexported fields }
Config contains common worker config.
type RuntimeHostConfig ¶
type RuntimeHostConfig struct { // Provisioners contains a set of supported runtime provisioners, based on TEE hardware. Provisioners map[node.TEEHardware]runtimeHost.Provisioner // Runtimes contains per-runtime provisioning configuration. Some fields may be omitted as they // are provided when the runtime is provisioned. Runtimes map[common.Namespace]runtimeHost.Config }
RuntimeHostConfig is configuration for a worker that hosts runtimes.
type RuntimeHostHandlerFactory ¶
type RuntimeHostHandlerFactory interface { // GetRuntime returns the registered runtime for which a runtime host handler is to be created. GetRuntime() runtimeRegistry.Runtime // NewRuntimeHostHandler creates a new runtime host handler. NewRuntimeHostHandler() protocol.Handler // NewNotifier creates a new runtime host notifier. NewNotifier(ctx context.Context, 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 ¶
RuntimeHostNode provides methods for nodes that need to host runtimes.
func NewRuntimeHostNode ¶
func NewRuntimeHostNode(cfg *RuntimeHostConfig, factory RuntimeHostHandlerFactory) (*RuntimeHostNode, error)
NewRuntimeHostNode creates a new runtime host node.
func (*RuntimeHostNode) GetHostedRuntime ¶
func (n *RuntimeHostNode) GetHostedRuntime() host.Runtime
GetHostedRuntime returns the provisioned hosted runtime (if any).
func (*RuntimeHostNode) ProvisionHostedRuntime ¶
func (n *RuntimeHostNode) ProvisionHostedRuntime(ctx context.Context) (host.Runtime, protocol.Notifier, error)
ProvisionHostedRuntime provisions the configured runtime.
This method may return before the runtime is fully provisioned. The returned runtime will not be started automatically, you must call Start explicitly.
type Worker ¶
type Worker struct { DataDir string Identity *identity.Identity Consensus consensus.Backend Grpc *grpc.Server GrpcPolicyWatcher policyAPI.PolicyWatcher P2P *p2p.P2P IAS ias.Endpoint KeyManager keymanagerApi.Backend RuntimeRegistry runtimeRegistry.Registry GenesisDoc *genesis.Document // contains filtered or unexported fields }
Worker is a garbage bag with lower level services and common runtime objects.
func New ¶
func New( dataDir string, enabled bool, identity *identity.Identity, consensus consensus.Backend, p2p *p2p.P2P, ias ias.Endpoint, keyManager keymanagerApi.Backend, runtimeRegistry runtimeRegistry.Registry, genesisDoc *genesis.Document, ) (*Worker, error)
New creates a new worker.
func (*Worker) Cleanup ¶
func (w *Worker) Cleanup()
Cleanup performs the service specific post-termination cleanup.
func (*Worker) GetRuntime ¶
GetRuntime returns a common committee node for the given runtime (if available).
In case the runtime with the specified id was not configured for this node it returns nil.
func (*Worker) GetRuntimes ¶
GetRuntimes returns a map of configured runtimes.
func (*Worker) Initialized ¶
func (w *Worker) Initialized() <-chan struct{}
Initialized returns a channel that will be closed when the transaction scheduler is initialized and ready to service requests.
func (*Worker) NewUnmanagedCommitteeNode ¶
func (w *Worker) NewUnmanagedCommitteeNode(runtime runtimeRegistry.Runtime, enableP2P bool) (*committee.Node, error)
NewUnmanagedCommitteeNode creates a new common committee node that is not managed by this worker.
Since the node is unmanaged the caller needs to ensure that the node will be properly terminated once started.
Note that this does not instruct the storage backend to watch the given runtime.