In Development Package, API may change between versions.

import "github.com/egdaemon/eg/runtime/x/wasi/egvm"

Package egvm runs modules in a virtual machine whose root is an egiso, in place of a container:

eg.Module(ctx, egvm.New("https://example.com/root.egiso", "sha256:…"), ops...)

type VM

VM is the egiso implementation of the virtualization layer (eg.C and eg.V).

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

func New

func New(location string, toc string) VM

New runs modules with the egiso at location, an https URL or a path on the host, as their root. toc, the digest of the egiso's table of contents, pins it: the host refuses an egiso whose table of contents does not match, and checks every chunk it reads against that table. Changes a module makes to the root last for that module's run.

func (VM) CompileWith

func (t VM) CompileWith(ctx context.Context) error

CompileWith prepares nothing: the host opens and verifies the egiso when a module runs in it.

func (VM) RunWith

func (t VM) RunWith(ctx context.Context, mpath string) error

RunWith runs the module at mpath in the machine.

func (VM) ToModuleRunner

func (t VM) ToModuleRunner() VM

internal use.

⬤