wazero

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: BSD-3-Clause Imports: 20 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

This section is empty.

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
}

Options configures the executor.

Jump to

Keyboard shortcuts

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