Documentation
¶
Index ¶
Constants ¶
const HostModuleName = "lesstruct"
HostModuleName is the wazero host module name capability functions are registered under. Guests import it (e.g. log_info); the loader instantiates it from the plugin's capability manifest.
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) 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).