Documentation ¶
Overview ¶
Package host implements the functionality to provision and talk to runtimes.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidArgument is the error returned when any of the passed method arguments is invalid. ErrInvalidArgument = errors.New("runtime: invalid argument") // ErrCheckTxFailed is the error returned when a transaction is rejected by the runtime. ErrCheckTxFailed = errors.New("runtime: check tx failed") // ErrInternal is the error returned when an unspecified internal error occurs. ErrInternal = errors.New("runtime: internal error") )
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // RuntimeID is the unique runtime identifier. RuntimeID common.Namespace // Path is the path to the resource required for provisioning a runtime. This can be an ELF // binary, an SGXS binary or even a VM image. The semantics of this field are entirely up to the // used provisioner. Path string // Extra is an optional provisioner-specific configuration. Extra interface{} // MessageHandler is the message handler for the Runtime Host Protocol messages. MessageHandler protocol.Handler }
Config contains common configuration for the provisioned runtime.
type Event ¶
type Event struct { Started *StartedEvent FailedToStart *FailedToStartEvent Stopped *StoppedEvent Updated *UpdatedEvent }
Event is a runtime host event.
type FailedToStartEvent ¶
type FailedToStartEvent struct { // Error is the error that has occurred. Error error }
FailedToStartEvent is a failed to start runtime event.
type Provisioner ¶
type Provisioner interface { // NewRuntime provisions a new runtime. // // This method may return before the runtime is fully provisioned. The returned runtime will not // be started automatically, you must call Start explicitly. NewRuntime(ctx context.Context, cfg Config) (Runtime, error) }
Provisioner is the runtime provisioner interface.
type RichRuntime ¶ added in v0.2100.0
type RichRuntime interface { Runtime // CheckTx requests the runtime to check a given transaction. CheckTx(ctx context.Context, rb *block.Block, lb *consensus.LightBlock, tx []byte) error // Query requests the runtime to answer a runtime-specific query. Query(ctx context.Context, rb *block.Block, method string, args cbor.RawMessage) (cbor.RawMessage, error) }
RichRuntime provides higher-level functions for talking with a runtime.
func NewRichRuntime ¶ added in v0.2100.0
func NewRichRuntime(rt Runtime) RichRuntime
NewRichRuntime creates a new higher-level wrapper for a given runtime. It provides additional convenience functions for talking with a runtime.
type Runtime ¶
type Runtime interface { // ID is the runtime identifier. ID() common.Namespace // Call sends a request message to the runtime over the Runtime Host Protocol and waits for the // response (which may be a failure). Call(ctx context.Context, body *protocol.Body) (*protocol.Body, error) // WatchEvents subscribes to runtime status events. WatchEvents(ctx context.Context) (<-chan *Event, pubsub.ClosableSubscription, error) // Start attempts to start the runtime. Start() error // Abort attempts to abort a runtime so that it will be ready to service new requests. // In case abort fails or force flag is set, the runtime will be restarted. Abort(ctx context.Context, force bool) error // Stop signals the provisioned runtime to stop. Stop() }
Runtime is a provisioned runtime interface.
type RuntimeEventEmitter ¶
type RuntimeEventEmitter interface { // EmitEvent allows the caller to emit a runtime event. EmitEvent(ev *Event) }
RuntimeEventEmitter is the interface for emitting events for a provisioned runtime.
type StartedEvent ¶
type StartedEvent struct { // Version is the runtime version. Version version.Version // CapabilityTEE is the newly started runtime's CapabilityTEE. It may be nil in case the runtime // is not running inside a TEE. CapabilityTEE *node.CapabilityTEE }
StartedEvent is a runtime started event.
type UpdatedEvent ¶
type UpdatedEvent struct { // CapabilityTEE is the updated runtime's CapabilityTEE. It may be nil in case the runtime is // not running inside a TEE. CapabilityTEE *node.CapabilityTEE }
UpdatedEvent is a runtime metadata updated event.
Directories ¶
Path | Synopsis |
---|---|
Package mock implements a mock runtime host useful for tests.
|
Package mock implements a mock runtime host useful for tests. |
Package protocol implements the Runtime Host Protocol.
|
Package protocol implements the Runtime Host Protocol. |
Package sandbox implements the runtime provisioner for runtimes in sandboxed processes.
|
Package sandbox implements the runtime provisioner for runtimes in sandboxed processes. |
process
Package process implements a process sandboxing mechanism.
|
Package process implements a process sandboxing mechanism. |
Package sgx implements the runtime provisioner for runtimes in Intel SGX enclaves.
|
Package sgx implements the runtime provisioner for runtimes in Intel SGX enclaves. |
Package tests contains common tests for runtime host implementations.
|
Package tests contains common tests for runtime host implementations. |