wasmhost

package
v0.13.2 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExecutionInfo

type ExecutionInfo interface {
	ExecutionId() string
	Buffers() utils.OutputBuffers
	Messages() []utils.LogMessage
	Result() any
}

func CallFunction

func CallFunction(ctx context.Context, fnName string, paramValues ...any) (ExecutionInfo, error)

type HostFunctionOption

type HostFunctionOption func(*hostFunction)

func WithCancelledMessage

func WithCancelledMessage(text string) HostFunctionOption

func WithCompletedMessage

func WithCompletedMessage(text string) HostFunctionOption

func WithErrorMessage

func WithErrorMessage(text string) HostFunctionOption

func WithMessageDetail

func WithMessageDetail(fn any) HostFunctionOption

func WithStartingMessage

func WithStartingMessage(text string) HostFunctionOption

type WasmHost

type WasmHost interface {
	RegisterHostFunction(modName, funcName string, fn any, opts ...HostFunctionOption) error
	CallFunction(ctx context.Context, fnInfo functions.FunctionInfo, parameters map[string]any) (ExecutionInfo, error)
	CallFunctionByName(ctx context.Context, fnName string, paramValues ...any) (ExecutionInfo, error)
	Close(ctx context.Context)
	CompileModule(ctx context.Context, bytes []byte) (wazero.CompiledModule, error)
	GetFunctionInfo(fnName string) (functions.FunctionInfo, error)
	GetFunctionRegistry() functions.FunctionRegistry
	GetModuleInstance(ctx context.Context, plugin *plugins.Plugin, buffers utils.OutputBuffers) (wasm.Module, error)
}

func GetWasmHost

func GetWasmHost(ctx context.Context) WasmHost

func InitWasmHost

func InitWasmHost(ctx context.Context, registrations ...func(WasmHost) error) WasmHost

func NewWasmHost

func NewWasmHost(ctx context.Context, registrations ...func(WasmHost) error) WasmHost

Jump to

Keyboard shortcuts

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