extplugin

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2026 License: GPL-3.0 Imports: 26 Imported by: 0

Documentation

Overview

Package extplugin adapts an out-of-process plugin subprocess to plugin.Plugin so the registry, projection, and route wrapper treat it like a built-in.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

New fetches and reconstructs the manifest once, binding each route to a gRPC shim that forwards to the subprocess.

Types

type AuditFunc

type AuditFunc func(result plugin.AuditResult, params map[string]string, errMsg string)

AuditFunc records a stream-internal operation a plugin reported via Host.Audit.

type Loaded

type Loaded struct {
	Name    string
	Path    string
	Healthy bool
}

Loaded describes one currently-loaded external plugin for the admin surface.

type Manager

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

Manager discovers, spawns, and supervises out-of-process plugin binaries. A crashed plugin is respawned with bounded backoff; its registered manifest and routes are unchanged — only the live gRPC client is swapped underneath.

func NewManager

func NewManager(dir string, opts ...Option) *Manager

func (*Manager) Close

func (m *Manager) Close()

Close terminates every spawned subprocess and stops its supervisor.

func (*Manager) IsManaged

func (m *Manager) IsManaged(name string) bool

IsManaged reports whether name is a loaded external plugin.

func (*Manager) LoadAll

func (m *Manager) LoadAll(ctx context.Context, reg *pluginregistry.Registry) error

LoadAll spawns and registers every plugin binary in the directory. A binary that fails to load is skipped so one bad plugin cannot block the rest; the joined load errors are returned. A missing directory is not an error.

func (*Manager) LoadOne

func (m *Manager) LoadOne(ctx context.Context, reg *pluginregistry.Registry, path string) error

LoadOne spawns and registers a single freshly-installed plugin binary at runtime (the marketplace install path).

func (*Manager) Loaded

func (m *Manager) Loaded() []Loaded

Loaded returns a snapshot of every loaded external plugin and whether its subprocess is currently running.

func (*Manager) Uninstall

func (m *Manager) Uninstall(reg *pluginregistry.Registry, name string) error

Uninstall stops a managed external plugin, removes it from the runtime registry, and deletes the installed binary.

func (*Manager) Update

func (m *Manager) Update(ctx context.Context, reg *pluginregistry.Registry, name, path string) error

Update swaps a loaded plugin for the new binary at path: the new subprocess must present the same plugin name, the registry entry is replaced, and only then is the old subprocess stopped. Live sessions of the old version are dropped; the session registry reconnects lazily.

type Option

type Option func(*Manager)

Option configures a Manager.

func WithAudit

func WithAudit(audit AuditFunc) Option

WithAudit records stream-internal operations plugins report via Host.Audit.

func WithLogger

func WithLogger(logger *slog.Logger) Option

WithLogger routes plugin subprocess output and supervisor events into the gateway's structured logger. Without it, that output is discarded.

Jump to

Keyboard shortcuts

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