Documentation
¶
Index ¶
- type Constructor
- type Controller
- func (c *Controller) Close() error
- func (c *Controller) Execute(rctx context.Context) error
- func (c *Controller) GetControllerID() string
- func (c *Controller) GetControllerInfo() *controller.Info
- func (c *Controller) GetWebRuntime(ctx context.Context) (web_runtime.WebRuntime, error)
- func (c *Controller) HandleDirective(ctx context.Context, di directive.Instance) ([]directive.Resolver, error)
- func (c *Controller) HandleFetch(strm fetch.SRPCFetchService_FetchStream) error
- func (c *Controller) HandleWebDocument(wv web_document.WebDocument)
- func (c *Controller) ServeBrowserIndexHTML(rw http.ResponseWriter, req *http.Request)
- func (c *Controller) ServePluginAssetsFsHTTP(pluginID string, rw http.ResponseWriter, req *http.Request)
- func (c *Controller) ServePluginDistFsHTTP(pluginID string, rw http.ResponseWriter, req *http.Request)
- func (c *Controller) ServePluginHTTP(pluginID string, rw http.ResponseWriter, req *http.Request)
- func (c *Controller) ServeQuickJSHTTP(filePath string, rw http.ResponseWriter, req *http.Request)
- func (c *Controller) ServeServiceWorkerHTTP(rw http.ResponseWriter, req *http.Request)
- func (c *Controller) ServeWebModuleHTTP(pkgPath string, rw http.ResponseWriter, req *http.Request)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Constructor ¶
type Constructor func( ctx context.Context, le *logrus.Entry, handler web_runtime.WebRuntimeHandler, ) (web_runtime.WebRuntime, error)
Constructor constructs a runtime with common parameters.
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Controller implements a common bldr web runtime controller. Tracks attached WebRuntime state and manages RPC calls in/out.
func NewController ¶
func NewController( le *logrus.Entry, bus bus.Bus, ctor Constructor, runtimeID string, runtimeVersion semver.Version, ) *Controller
NewController constructs a new runtime controller.
func (*Controller) Close ¶
func (c *Controller) Close() error
Close releases any resources used by the controller. Error indicates any issue encountered releasing.
func (*Controller) Execute ¶
func (c *Controller) Execute(rctx context.Context) error
Execute executes the runtime controller and the runtime itself. Returning nil ends execution. Returning an error triggers a retry with backoff.
func (*Controller) GetControllerID ¶
func (c *Controller) GetControllerID() string
GetControllerID returns the controller ID.
func (*Controller) GetControllerInfo ¶
func (c *Controller) GetControllerInfo() *controller.Info
GetControllerInfo returns information about the controller.
func (*Controller) GetWebRuntime ¶
func (c *Controller) GetWebRuntime(ctx context.Context) (web_runtime.WebRuntime, error)
GetWebRuntime returns the controlled runtime, waiting for it to be non-nil.
func (*Controller) HandleDirective ¶
func (c *Controller) HandleDirective(ctx context.Context, di directive.Instance) ([]directive.Resolver, error)
HandleDirective asks if the handler can resolve the directive. If it can, it returns a resolver. If not, returns nil. Any unexpected errors are returned for logging. It is safe to add a reference to the directive during this call.
func (*Controller) HandleFetch ¶
func (c *Controller) HandleFetch(strm fetch.SRPCFetchService_FetchStream) error
HandleFetch handles an incoming Fetch request from the web runtime. The Client ID can be used to distinguish between windows / browser tabs.
func (*Controller) HandleWebDocument ¶
func (c *Controller) HandleWebDocument(wv web_document.WebDocument)
HandleWebDocument handles an incoming WebDocument.
func (*Controller) ServeBrowserIndexHTML ¶ added in v0.51.3
func (c *Controller) ServeBrowserIndexHTML(rw http.ResponseWriter, req *http.Request)
ServeBrowserIndexHTML serves the browser root document from the Go runtime.
func (*Controller) ServePluginAssetsFsHTTP ¶
func (c *Controller) ServePluginAssetsFsHTTP(pluginID string, rw http.ResponseWriter, req *http.Request)
ServePluginAssetsFsHTTP serves a HTTP request for a plugin assets filesystem.
func (*Controller) ServePluginDistFsHTTP ¶
func (c *Controller) ServePluginDistFsHTTP(pluginID string, rw http.ResponseWriter, req *http.Request)
ServePluginDistFsHTTP serves a HTTP request for a plugin dist filesystem.
func (*Controller) ServePluginHTTP ¶
func (c *Controller) ServePluginHTTP(pluginID string, rw http.ResponseWriter, req *http.Request)
ServePluginHTTP serves a ServiceWorker HTTP request for a plugin.
func (*Controller) ServeQuickJSHTTP ¶
func (c *Controller) ServeQuickJSHTTP(filePath string, rw http.ResponseWriter, req *http.Request)
ServeQuickJSHTTP serves QuickJS runtime files at /b/qjs/. Available files:
- qjs-wasi.wasm - The QuickJS WASI binary
- plugin-quickjs.esm.js - The boot harness for running plugins
func (*Controller) ServeServiceWorkerHTTP ¶
func (c *Controller) ServeServiceWorkerHTTP(rw http.ResponseWriter, req *http.Request)
ServeServiceWorkerHTTP serves a ServiceWorker HTTP request.
func (*Controller) ServeWebModuleHTTP ¶
func (c *Controller) ServeWebModuleHTTP(pkgPath string, rw http.ResponseWriter, req *http.Request)
ServeWebModuleHTTP serves a ServiceWorker HTTP request for a web module at /b/pkg.
pkgPath is the path after /b/pkg/ - for example, "pkg" or "pkg/client.js" or "@my/pkg". The first element(s) of the path (split by /) are used as the package name. If the path begins with @, it is treated as a scope: @scope/package/...