wazero

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2023 License: Apache-2.0 Imports: 10 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultRuntime added in v0.5.0

func DefaultRuntime(ctx context.Context) (wazero.Runtime, error)

DefaultRuntime implements NewRuntime by returning a wazero runtime with WASI and AssemblyScript host functions instantiated.

func Engine

func Engine() wapc.Engine

Engine returns a new wapc.Engine which uses the DefaultRuntime.

func EngineWithRuntime added in v0.5.0

func EngineWithRuntime(newRuntime NewRuntime) wapc.Engine

EngineWithRuntime allows you to customize or return an alternative to DefaultRuntime,

Types

type Instance

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

func (*Instance) Close

func (i *Instance) Close(ctx context.Context) error

Close implements the same method as documented on wapc.Instance.

func (*Instance) Invoke

func (i *Instance) Invoke(ctx context.Context, operation string, payload []byte) ([]byte, error)

Invoke implements the same method as documented on wapc.Instance.

func (*Instance) MemorySize

func (i *Instance) MemorySize() uint32

MemorySize implements the same method as documented on wapc.Instance.

func (*Instance) UnwrapModule added in v0.5.5

func (i *Instance) UnwrapModule() api.Module

UnwrapModule allows access to wazero-specific api.Module.

type Module

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

Module represents a compiled waPC module.

func (*Module) Close

func (m *Module) Close(ctx context.Context) (err error)

Close implements the same method as documented on wapc.Module.

func (*Module) Instantiate

func (m *Module) Instantiate(ctx context.Context) (wapc.Instance, error)

Instantiate implements the same method as documented on wapc.Module.

func (*Module) UnwrapRuntime added in v0.5.5

func (m *Module) UnwrapRuntime() *wazero.Runtime

UnwrapRuntime allows access to wazero-specific runtime features.

func (*Module) WithConfig added in v0.6.1

func (m *Module) WithConfig(callback func(wazero.ModuleConfig) wazero.ModuleConfig)

WithConfig allows you to override or replace wazero.ModuleConfig used to instantiate each guest. This can be used to configure clocks or filesystem access.

The default (function input) conflgures WASI and waPC init functions as well as stdout and stderr.

type NewRuntime added in v0.5.0

type NewRuntime func(context.Context) (wazero.Runtime, error)

NewRuntime returns a new wazero runtime which is called when the New method on wapc.Engine is called. The result is closed upon wapc.Module Close.

Jump to

Keyboard shortcuts

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