Help us shape the future of Go! Take the 2026 Go Developer Survey

wazero

package
v0.26.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 29, 2026 License: BSD-3-Clause Imports: 22 Imported by: 0

Documentation

Overview

Package wazero is the native Executor: it runs a container's wasip1 module with wazero (pure Go, no cgo), the container's rootfs mounted as the guest's "/".

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WASIMounts added in v0.8.0

func WASIMounts(ms []runtime.Mount) []wasi.Mount

WASIMounts converts runtime mounts for the engine's WASI host.

Types

type Executor

type Executor struct {
	// contains filtered or unexported fields
}

Executor runs modules with wazero. Compiled modules are cached by the sha256 of their bytes and memory limit, so a second container of the same image does not compile again.

func New

func New(opt Options) *Executor

New returns an executor.

func (*Executor) CacheLen

func (e *Executor) CacheLen() int

CacheLen reports how many compiled modules are cached.

func (*Executor) Close

func (e *Executor) Close(ctx context.Context) error

Close implements runtime.Executor.

func (*Executor) Start

func (e *Executor) Start(ctx context.Context, spec runtime.Spec) (runtime.Process, error)

Start implements runtime.Executor.

type Options

type Options struct {
	// DefaultMemoryLimitBytes applies when a Spec sets none (default 256 MiB).
	DefaultMemoryLimitBytes int64
	// MaxCompiled bounds the compiled-module cache (default 64 modules).
	MaxCompiled int
	// Interpreter forces wazero's interpreter instead of its compiler.
	Interpreter bool
	// EngineWASI serves wasi_snapshot_preview1 with the engine's own host
	// (package wasi, the one the browser executor uses) instead of
	// wazero's. It exists so that host is exercised natively by real
	// guests.
	EngineWASI bool
	// HostModules are served beside wasi_snapshot_preview1 (wasi-nn,
	// wasi:webgpu, …). They run in the engine's WASI host, so setting any
	// implies EngineWASI.
	HostModules []wasi.HostModule
}

Options configures the executor.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL