Documentation
¶
Index ¶
- type Capability
- type Cell
- func (p *Cell) Call(ctx context.Context, funcName string, args []byte) ([]byte, error)
- func (p *Cell) Close(ctx context.Context) error
- func (p *Cell) HasProvider() bool
- func (p *Cell) Init(ctx context.Context, config []byte) error
- func (p *Cell) Name() string
- func (p *Cell) ProbeConfigMarker(ctx context.Context) (int64, bool)
- func (p *Cell) ProbeLastCall(ctx context.Context) (uint64, bool)
- func (p *Cell) Shutdown(ctx context.Context) error
- func (p *Cell) 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 Cell ¶ added in v0.2.0
type Cell struct {
// contains filtered or unexported fields
}
Cell is a single loaded WASM module with the three required Pulp exports.
func Load ¶
func Load(ctx context.Context, spec *manifest.CellSpec, registry *Registry, logger *slog.Logger) (*Cell, error)
Load reads the cell'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 cell module is instantiated so its imports resolve correctly.
Passing a nil registry is valid — the cell gets only the WASI imports wazero provides by default and no Pulp host imports. Useful for tests.
func (*Cell) Close ¶ added in v0.2.0
Close tears down the wazero runtime and releases all cell resources. Serialized against every other entry point via the module mutex so a concurrent Step / Call / Shutdown never races with runtime teardown. Safe to call more than once; later calls return nil.
func (*Cell) HasProvider ¶ added in v0.2.0
Call invokes the cell's pulp_on_call export. Used by the sibling call path: when cell B calls pulp_call on cell A, the host routes it here, serialized against A's own step loop by the module mutex.
The cell receives (funcName, args) and writes a msgpack-encoded response via pulp_alloc. Returns the raw response bytes (copied out of WASM memory) or an error on trap / nonzero return code / missing export.
HasProvider returns true iff the cell exports pulp_on_call.
func (*Cell) Init ¶ added in v0.2.0
Init calls pulp_init with the given config bytes. Config is written into WASM linear memory; the cell receives (ptr, len).
func (*Cell) Name ¶ added in v0.2.0
Name returns the cell's manifest name. Defined to satisfy the ext.Cell interface extensions receive when their Register or Stub functions run.
func (*Cell) ProbeConfigMarker ¶ added in v0.2.0
ProbeConfigMarker reads the cell'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 cell.
func (*Cell) ProbeLastCall ¶ added in v0.2.0
ProbeLastCall reads the cell's probe_last_call export if present. Diagnostic only — returns ok=false if the cell 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 cell 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 cell, 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 cell's manifest lists it under `capabilities`. Use for anything that touches the OS or the network.