Documentation
¶
Index ¶
- type DiscoveredPlugin
- type Loader
- func (l *Loader) DiscoverAll() (int, error)
- func (l *Loader) Discovered() []string
- func (l *Loader) DiscoveredPlugins() []*DiscoveredPlugin
- func (l *Loader) EnsureLoaded(ctx context.Context, name string) error
- func (l *Loader) LoadAll(ctx context.Context) (int, []error)
- func (l *Loader) LoadWASM(ctx context.Context, name string) error
- func (l *Loader) LoadWASMFromPath(ctx context.Context, path string) error
- func (l *Loader) Reload(ctx context.Context, name string) error
- func (l *Loader) StopWatch()
- func (l *Loader) Unload(ctx context.Context, name string) error
- func (l *Loader) WatchDir(ctx context.Context) error
- type LoaderOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DiscoveredPlugin ¶
type DiscoveredPlugin struct {
Name string // Derived from filename
Path string // Full path to .wasm file
Type string // "wasm" or "grpc"
Loaded bool // Whether it's been loaded
LoadedAt time.Time
}
DiscoveredPlugin holds info about a plugin found but not yet loaded.
type Loader ¶
type Loader struct {
// contains filtered or unexported fields
}
Loader handles discovery and loading of plugins from the filesystem.
func NewLoader ¶
func NewLoader(pluginDir string, manager *plugin.Manager, logger *slog.Logger, opts ...LoaderOption) *Loader
NewLoader creates a plugin loader for the given directory.
func (*Loader) DiscoverAll ¶
DiscoverAll scans the plugin directory and records available plugins without loading them. Use with lazy loading - plugins will be loaded on first use.
func (*Loader) Discovered ¶
Discovered returns the names of discovered (but possibly not loaded) plugins. Implements plugin.LazyLoader interface.
func (*Loader) DiscoveredPlugins ¶
func (l *Loader) DiscoveredPlugins() []*DiscoveredPlugin
DiscoveredPlugins returns detailed info about discovered plugins.
func (*Loader) EnsureLoaded ¶
EnsureLoaded loads a plugin by name if not already loaded (for lazy loading).
func (*Loader) LoadAll ¶
LoadAll discovers and loads all plugins from the plugin directory. If lazy loading is enabled, only discovers plugins without loading them. Returns the number of successfully loaded/discovered plugins and any errors encountered.
func (*Loader) LoadWASMFromPath ¶
LoadWASMFromPath loads a WASM plugin from an arbitrary path.
type LoaderOption ¶
type LoaderOption func(*Loader)
LoaderOption configures a Loader.
func WithLazyLoading ¶
func WithLazyLoading() LoaderOption
WithLazyLoading enables lazy loading - plugins are discovered but not loaded until first use.