Documentation
¶
Overview ¶
Package wasm provides a WASM-based plugin runtime using wazero.
WASM plugins are portable, sandboxed modules that communicate with the host via exported functions. This is the default/recommended plugin runtime.
Plugin contract:
- Export gk_register() -> returns JSON manifest
- Export gk_call(fn_ptr, fn_len, args_ptr, args_len) -> returns response ptr
- Export gk_malloc(size) -> allocate memory for host-to-plugin data
- Export gk_free(ptr) -> free memory
Host provides:
- gk_host_call(fn_ptr, fn_len, args_ptr, args_len) -> call host API
- gk_log(level, msg_ptr, msg_len) -> logging
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type WASMPlugin ¶
type WASMPlugin struct {
// contains filtered or unexported fields
}
WASMPlugin implements plugin.Plugin for WASM modules.
func Load ¶
func Load(ctx context.Context, wasmBytes []byte) (*WASMPlugin, error)
Load creates a WASM plugin from raw bytes.
func LoadFromFile ¶
func LoadFromFile(ctx context.Context, path string) (*WASMPlugin, error)
LoadFromFile loads a WASM plugin from a file path.
func (*WASMPlugin) Call ¶
func (p *WASMPlugin) Call(ctx context.Context, fn string, args json.RawMessage) (json.RawMessage, error)
Call implements plugin.Plugin.
func (*WASMPlugin) GKRegister ¶
func (p *WASMPlugin) GKRegister() plugin.GKRegistration
GKRegistration implements plugin.Plugin.
Click to show internal directories.
Click to hide internal directories.