hostfunctions

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DBExecutor

type DBExecutor interface {
	QueryContext(ctx context.Context, query string, args ...any) (*sql.Rows, error)
	ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error)
}

DBExecutor abstracts database operations for host functions.

type Registry

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

Registry holds the host-side resources that host functions can access. Each plugin instantiation creates a filtered view based on its manifest.

func NewRegistry

func NewRegistry(
	httpClient *http.Client,
	db DBExecutor,
	logger func(string),
) *Registry

NewRegistry creates a new host function registry.

func (*Registry) Close

func (r *Registry) Close() error

Close cleans up resources held by the registry.

func (*Registry) InstantiateModule

func (r *Registry) InstantiateModule(
	ctx context.Context,
	rt wazero.Runtime,
	manifest *capability.Manifest,
) (api.Module, error)

InstantiateModule creates a wazero host module exposing only the host functions allowed by the given manifest. If the manifest is nil or declares no capabilities, no module is instantiated (returns nil, nil).

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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