plugin

package
v1.801.79 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package pluginsvc is the runtime plugin loader for the unified cloud binary.

cloud is a thin host: its native Go subsystems are compiled in, but everything else mounts at RUNTIME from a manifest — no cloud rebuild to add or update a service. Two plugin kinds, both reduced to "produce an http.Handler, then app.All(prefix+"/*", zip.AdaptNetHTTP(h))":

  • wasm — a polyglot service (Rust/WASM, or Python/TS via goa) loaded in-process through github.com/hanzoai/goa (wazero/gpython/goja, pure Go, CGO_ENABLED=0). Drop a .wasm + manifest entry → mounted.
  • proxy — a standalone server (e.g. the beego apps ai, vm) reached over a pluggable transport. The "zap" transport is registered by the ZAP client when available; until then proxying uses plain HTTP. Either way cloud never recompiles to point at a service.

The manifest path comes from CLOUD_PLUGINS (a JSON file); if unset, pluginsvc mounts nothing. Adding a service = edit the manifest + drop a .wasm or redeploy the standalone — cloud is unchanged unless its own core changes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Mount

func Mount(app *zip.App, deps cloud.Deps) error

Mount reads the plugin manifest and mounts every plugin onto app. Missing or unset manifest is a no-op (cloud runs fine with zero plugins).

func RegisterTransport

func RegisterTransport(name string, rt http.RoundTripper)

RegisterTransport makes rt selectable as Plugin.Via == name. Called from the transport client's init() (e.g. the ZAP client registers "zap").

func Shutdown

func Shutdown(context.Context) error

Shutdown releases every mounted goa service pool. Idempotent.

Types

type Manifest

type Manifest struct {
	Plugins []Plugin `json:"plugins"`
}

Manifest is the runtime plugin set.

type Plugin

type Plugin struct {
	Name   string `json:"name"`
	Kind   string `json:"kind"`   // "wasm" | "proxy" | "native"
	Prefix string `json:"prefix"` // mount point, e.g. /v1/pricing

	// kind=wasm (goa): a polyglot module + its route table.
	Lang   string            `json:"lang,omitempty"`   // "rust"/"wasm", "python", "javascript"…
	Source string            `json:"source,omitempty"` // path to .wasm/.py/.ts, relative to the manifest
	Pool   int               `json:"pool,omitempty"`   // pooled interpreters (default 8)
	Routes []goa.Route       `json:"routes,omitempty"`
	Env    map[string]string `json:"env,omitempty"`

	// kind=proxy: a standalone server reached over a transport.
	Target      string `json:"target,omitempty"`      // e.g. http://ai.internal:8080
	Via         string `json:"via,omitempty"`         // transport: "http" (default) | "zap"
	StripPrefix bool   `json:"stripPrefix,omitempty"` // strip Prefix before forwarding
}

Plugin is one manifest entry. Kind selects which fields apply.

Jump to

Keyboard shortcuts

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