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 ¶
- func New(ctx context.Context, client pluginv1.PluginClient) (plugin.Plugin, error)
- type AuditFunc
- type Loaded
- type Manager
- func (m *Manager) Close()
- func (m *Manager) IsManaged(name string) bool
- func (m *Manager) LoadAll(ctx context.Context, reg *pluginregistry.Registry) error
- func (m *Manager) LoadOne(ctx context.Context, reg *pluginregistry.Registry, path string) error
- func (m *Manager) Loaded() []Loaded
- func (m *Manager) Uninstall(reg *pluginregistry.Registry, name string) error
- func (m *Manager) Update(ctx context.Context, reg *pluginregistry.Registry, name, path string) error
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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 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 (*Manager) Close ¶
func (m *Manager) Close()
Close terminates every spawned subprocess and stops its supervisor.
func (*Manager) LoadAll ¶
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 ¶
LoadOne spawns and registers a single freshly-installed plugin binary at runtime (the marketplace install path).
func (*Manager) 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 WithLogger ¶
WithLogger routes plugin subprocess output and supervisor events into the gateway's structured logger. Without it, that output is discarded.