plugins

package
v1.0.0-beta.5 Latest Latest
Warning

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

Go to latest
Published: May 13, 2026 License: ISC Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewModule

func NewModule(name, path string) target.Module

NewModule adapts an executable plugin into target.Module.

Types

type LoadedPlugin

type LoadedPlugin struct {
	Name    string
	Path    string
	Source  string
	Version string
}

LoadedPlugin is one plugin executable registered into the runtime module map.

func BuildRegistry

func BuildRegistry(base target.ModuleRegistry, opts Options) (target.ModuleRegistry, []LoadedPlugin, error)

BuildRegistry merges built-in modules with discovered plugins. Plugin names may not shadow built-ins and duplicate plugin names are rejected.

type Options

type Options struct {
	BinaryDir              string
	WorkingDir             string
	PreferredDirs          []string
	ExclusivePreferredDirs bool
}

Options controls plugin discovery and registration.

type Plugin

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

Plugin adapts an executable plugin into target.Module. Each Plugin owns at most one live client at a time; the client is lazily created on first Check or Apply and reused across calls until reset or Close.

Plugin satisfies target.PluggableModule: LocalTarget clones it per-instance so each target keeps its own plugin client, and other transports use the interface to report a friendlier "use local or a staged bundle" error when a plugin is invoked over a transport that cannot delegate.

func (*Plugin) Apply

func (m *Plugin) Apply(ctx context.Context, params map[string]any, _ target.OutputFunc) (target.ApplyResult, error)

func (*Plugin) Check

func (m *Plugin) Check(ctx context.Context, params map[string]any, _ target.OutputFunc) (target.CheckResult, error)

func (*Plugin) CloneModule

func (m *Plugin) CloneModule() target.Module

CloneModule returns a fresh Plugin sharing the same name, path, and factory but no live client. Used by LocalTarget so each target instance gets its own plugin subprocess state.

func (*Plugin) Close

func (m *Plugin) Close() error

func (*Plugin) PluginPath

func (m *Plugin) PluginPath() string

PluginPath returns the filesystem path to the backing plugin executable.

Jump to

Keyboard shortcuts

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