Documentation
¶
Index ¶
- type Capability
- type Plugin
- func (p *Plugin) Close(ctx context.Context) error
- func (p *Plugin) Init(ctx context.Context, config []byte) error
- func (p *Plugin) Name() string
- func (p *Plugin) ProbeConfigMarker(ctx context.Context) (int64, bool)
- func (p *Plugin) ProbeLastCall(ctx context.Context) (uint64, bool)
- func (p *Plugin) Shutdown(ctx context.Context) error
- func (p *Plugin) Step(ctx context.Context, env abi.StepEnvelope) (outputHandle int32, err error)
- type Registry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Capability ¶
type Capability = ext.Capability
Capability is an alias of ext.Capability — the public extension type is canonical; this alias lets internal callers keep the short name without importing the ext path everywhere.
type Plugin ¶
type Plugin struct {
// contains filtered or unexported fields
}
Plugin is a single loaded WASM module with the three required Pulp exports.
func Load ¶
func Load(ctx context.Context, spec *manifest.PluginSpec, registry *Registry, logger *slog.Logger) (*Plugin, error)
Load reads the plugin's WASM file, binds the host capabilities declared in its manifest, instantiates the module, and resolves the three required exports. Host capabilities are bound via the Registry before the plugin module is instantiated so its imports resolve correctly.
Passing a nil registry is valid — the plugin gets only the WASI imports wazero provides by default and no Pulp host imports. Useful for tests.
func (*Plugin) Init ¶
Init calls pulp_init with the given config bytes. Config is written into WASM linear memory; the plugin receives (ptr, len).
func (*Plugin) Name ¶
Name returns the plugin's manifest name. Defined to satisfy the ext.Plugin interface extensions receive when their Register or Stub functions run.
func (*Plugin) ProbeConfigMarker ¶
ProbeConfigMarker reads the plugin's probe_config_marker export if present. Diagnostic only — used by the integration test to verify the manifest [config] table round-tripped through MessagePack into the plugin.
func (*Plugin) ProbeLastCall ¶
ProbeLastCall reads the plugin's probe_last_call export if present. Diagnostic only — returns ok=false if the plugin does not expose it.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
A Registry collects the Capabilities that this Pulp host knows how to provide. Some capabilities are always bound regardless of the manifest (logging, entropy); others are only bound when declared explicitly (transport.http.inbound, storage.sqlite, spawn.docker).
The registry is created at host startup and reused across plugin loads.
func NewRegistry ¶
func NewRegistry() *Registry
NewRegistry returns a Registry prepopulated with every extension that registered via ext.Register. Callers add built-in capabilities on top via Always / Gated before passing it to Load.
func (*Registry) Always ¶
func (r *Registry) Always(c Capability)
Always marks the capability as bound for every plugin, no declaration required. Use for universal imports like logging.
func (*Registry) Gated ¶
func (r *Registry) Gated(c Capability)
Gated marks the capability as bound only when the plugin's manifest lists it under `capabilities`. Use for anything that touches the OS or the network.