Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Middleware ¶
type Middleware interface {
// HandleRequest handles a request by calling handler.FuncHandleRequest on
// the guest.
//
// Note: If the handler.CtxNext is returned with `next=1`, you must call
// HandleResponse.
HandleRequest(ctx context.Context) (outCtx context.Context, ctxNext handler.CtxNext, err error)
// HandleResponse handles a response by calling handler.FuncHandleResponse
// on the guest. This is only called when HandleRequest returns
// handler.CtxNext with `next=1`.
//
// The ctx and ctxNext parameters are those returned from HandleRequest.
// Specifically, the handler.CtxNext "ctx" field is passed as `reqCtx`.
// The err parameter is nil unless the host erred processing the next
// handler.
HandleResponse(ctx context.Context, reqCtx uint32, err error) error
// Features are the features enabled while initializing the guest. This
// value won't change per-request.
Features() handler.Features
api.Closer
}
Middleware implements the http-wasm handler ABI. It is scoped to a single guest binary.
func NewMiddleware ¶
type NewRuntime ¶
NewRuntime returns a new wazero runtime which is called when creating a new middleware instance, which also closes it.
type Option ¶
type Option func(*options)
Option is configuration for NewMiddleware
func GuestConfig ¶
GuestConfig is the configuration used to instantiate the guest.
func Logger ¶
Logger sets the logger used by the guest when it calls "log". Defaults to api.NoopLogger.
func ModuleConfig ¶
func ModuleConfig(moduleConfig wazero.ModuleConfig) Option
ModuleConfig is the configuration used to instantiate the guest.
func Runtime ¶
func Runtime(newRuntime NewRuntime) Option
Runtime provides the wazero.Runtime and defaults to wazero.NewRuntime.
Click to show internal directories.
Click to hide internal directories.