Documentation
¶
Overview ¶
Package manager provides the plugin Manager for loading, managing, and monitoring plugins.
Index ¶
- func Handshake() plugin.HandshakeConfig
- type HTTPProxy
- type HostDataServer
- type HostPluginsServer
- type HostProgressServer
- type HostRatingsServer
- type HostStorageServer
- type HostWeatherServer
- type Manager
- func (m *Manager) DiscoverPlugins() ([]string, error)
- func (m *Manager) GetAllPlugins() []*types.Instance
- func (m *Manager) GetCapabilityRegistry() *registry.CapabilityRegistry
- func (m *Manager) GetEnrichers() []*types.Instance
- func (m *Manager) GetHTTPProxy() HTTPProxy
- func (m *Manager) GetHealthCheckInterval() time.Duration
- func (m *Manager) GetHostDataServer() HostDataServer
- func (m *Manager) GetHostPluginsServer() HostPluginsServer
- func (m *Manager) GetHostProgressServer() HostProgressServer
- func (m *Manager) GetHostRatingsServer() HostRatingsServer
- func (m *Manager) GetHostStorageServer() HostStorageServer
- func (m *Manager) GetHostVersion() string
- func (m *Manager) GetHostWeatherServer() HostWeatherServer
- func (m *Manager) GetLogger() *slog.Logger
- func (m *Manager) GetMaxRestarts() int
- func (m *Manager) GetPlugin(pluginID string) (*types.Instance, bool)
- func (m *Manager) GetPluginDir() string
- func (m *Manager) GetProviderRegistry() *registry.ProviderRegistry
- func (m *Manager) GetPublisher() domainevents.Publisher
- func (m *Manager) GetRateLimiter() *registry.RouteRateLimiter
- func (m *Manager) GetRouteRegistry() *registry.RouteRegistry
- func (m *Manager) GetSearchProviderRegistry() *registry.SearchProviderRegistry
- func (m *Manager) GetStorageDir() string
- func (m *Manager) GetSystemInfo() *pluginv1.SystemInfo
- func (m *Manager) GetTrendingProviderRegistry() *registry.TrendingProviderRegistry
- func (m *Manager) GetWidgetRegistry() *registry.WidgetRegistry
- func (m *Manager) IsPluginEnabled(pluginID string) bool
- func (m *Manager) ListPlugins() []*types.Instance
- func (m *Manager) LoadAllPlugins(ctx context.Context) error
- func (m *Manager) LoadPlugin(ctx context.Context, path string) (*types.Instance, error)
- func (m *Manager) PrintTable(w io.Writer, title string)
- func (m *Manager) RegisterPlugin(id string, instance *types.Instance)
- func (m *Manager) RestartPlugin(ctx context.Context, pluginID string) error
- func (m *Manager) SetHTTPProxy(proxy HTTPProxy)
- func (m *Manager) SetHostDataServer(server HostDataServer)
- func (m *Manager) SetHostPluginsServer(server HostPluginsServer)
- func (m *Manager) SetPluginFactory(factory PluginFactory)
- func (m *Manager) SetPublisher(pub domainevents.Publisher)
- func (m *Manager) SetSystemInfo(info *pluginv1.SystemInfo)
- func (m *Manager) Shutdown(ctx context.Context)
- func (m *Manager) StartHealthMonitor(ctx context.Context)
- func (m *Manager) UnloadPlugin(ctx context.Context, pluginID string) error
- func (m *Manager) UnregisterPlugin(id string)
- type ManagerConfig
- type PluginFactory
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Handshake ¶
func Handshake() plugin.HandshakeConfig
Handshake returns the plugin handshake configuration.
Types ¶
type HTTPProxy ¶
type HTTPProxy interface{}
HTTPProxy is an interface for the HTTP proxy functionality. This avoids a circular dependency with the parent plugins package.
type HostDataServer ¶
type HostDataServer interface{}
HostDataServer is an interface for the host data server functionality.
type HostPluginsServer ¶
type HostPluginsServer interface {
RegisterCapability(pluginID, pluginName, capability string)
UnregisterPlugin(pluginID string)
UpdatePluginStatus(pluginID string, enabled, configured bool)
HasCapability(capability string) bool
}
HostPluginsServer is an interface for the host plugins server functionality. This avoids a circular dependency with the parent plugins package.
type HostProgressServer ¶
type HostProgressServer interface{}
HostProgressServer is an interface for the host progress server functionality.
type HostRatingsServer ¶
type HostRatingsServer interface{}
HostRatingsServer is an interface for the host ratings server functionality.
type HostStorageServer ¶
type HostStorageServer interface{}
HostStorageServer is an interface for the host storage server functionality.
type HostWeatherServer ¶
type HostWeatherServer interface{}
HostWeatherServer is an interface for the host weather server functionality.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager manages plugin lifecycle and provides access to plugin services.
func NewManager ¶
func NewManager(cfg ManagerConfig, logger *slog.Logger) (*Manager, error)
NewManager creates a new plugin manager.
func (*Manager) DiscoverPlugins ¶
DiscoverPlugins scans the plugin directory for plugin binaries. It returns a list of paths to discovered plugins.
func (*Manager) GetAllPlugins ¶
GetAllPlugins returns all loaded plugins.
func (*Manager) GetCapabilityRegistry ¶
func (m *Manager) GetCapabilityRegistry() *registry.CapabilityRegistry
GetCapabilityRegistry returns the capability registry.
func (*Manager) GetEnrichers ¶
GetEnrichers returns all plugins that implement the Enricher interface.
func (*Manager) GetHTTPProxy ¶
GetHTTPProxy returns the HTTP proxy for plugin routes.
func (*Manager) GetHealthCheckInterval ¶
GetHealthCheckInterval returns the health check interval.
func (*Manager) GetHostDataServer ¶
func (m *Manager) GetHostDataServer() HostDataServer
GetHostDataServer returns the host data server.
func (*Manager) GetHostPluginsServer ¶
func (m *Manager) GetHostPluginsServer() HostPluginsServer
GetHostPluginsServer returns the host plugins server for capability-based plugin discovery.
func (*Manager) GetHostProgressServer ¶
func (m *Manager) GetHostProgressServer() HostProgressServer
GetHostProgressServer returns the host progress server.
func (*Manager) GetHostRatingsServer ¶
func (m *Manager) GetHostRatingsServer() HostRatingsServer
GetHostRatingsServer returns the host ratings server.
func (*Manager) GetHostStorageServer ¶
func (m *Manager) GetHostStorageServer() HostStorageServer
GetHostStorageServer returns the host storage server.
func (*Manager) GetHostVersion ¶
GetHostVersion returns the host version string.
func (*Manager) GetHostWeatherServer ¶
func (m *Manager) GetHostWeatherServer() HostWeatherServer
GetHostWeatherServer returns the host weather server.
func (*Manager) GetMaxRestarts ¶
GetMaxRestarts returns the maximum number of restarts.
func (*Manager) GetPluginDir ¶
GetPluginDir returns the plugin directory path.
func (*Manager) GetProviderRegistry ¶
func (m *Manager) GetProviderRegistry() *registry.ProviderRegistry
GetProviderRegistry returns the provider registry for provider plugins.
func (*Manager) GetPublisher ¶
func (m *Manager) GetPublisher() domainevents.Publisher
GetPublisher returns the event publisher.
func (*Manager) GetRateLimiter ¶
func (m *Manager) GetRateLimiter() *registry.RouteRateLimiter
GetRateLimiter returns the rate limiter.
func (*Manager) GetRouteRegistry ¶
func (m *Manager) GetRouteRegistry() *registry.RouteRegistry
GetRouteRegistry returns the route registry.
func (*Manager) GetSearchProviderRegistry ¶
func (m *Manager) GetSearchProviderRegistry() *registry.SearchProviderRegistry
GetSearchProviderRegistry returns the search provider registry.
func (*Manager) GetStorageDir ¶
GetStorageDir returns the storage directory path.
func (*Manager) GetSystemInfo ¶
func (m *Manager) GetSystemInfo() *pluginv1.SystemInfo
GetSystemInfo returns the system info.
func (*Manager) GetTrendingProviderRegistry ¶
func (m *Manager) GetTrendingProviderRegistry() *registry.TrendingProviderRegistry
GetTrendingProviderRegistry returns the trending provider registry.
func (*Manager) GetWidgetRegistry ¶
func (m *Manager) GetWidgetRegistry() *registry.WidgetRegistry
GetWidgetRegistry returns the widget registry for home screen widgets.
func (*Manager) IsPluginEnabled ¶
IsPluginEnabled returns true if the plugin exists, is loaded, and is healthy. Implements the PluginLookup interface for the HostPluginsServer.
func (*Manager) ListPlugins ¶
ListPlugins returns all loaded plugins.
func (*Manager) LoadAllPlugins ¶
LoadAllPlugins discovers and loads all plugins in the plugin directory. It performs dependency resolution to ensure provider plugins load before plugins that depend on them.
func (*Manager) LoadPlugin ¶
LoadPlugin loads a single plugin from the given path.
func (*Manager) PrintTable ¶
PrintTable writes a formatted table of all loaded plugins to the writer.
func (*Manager) RegisterPlugin ¶
RegisterPlugin adds a plugin instance to the manager.
func (*Manager) RestartPlugin ¶
RestartPlugin restarts a plugin by ID. This is useful when the plugin binary has been rebuilt and we need to reload it without a full server restart.
func (*Manager) SetHTTPProxy ¶
SetHTTPProxy sets the HTTP proxy.
func (*Manager) SetHostDataServer ¶
func (m *Manager) SetHostDataServer(server HostDataServer)
SetHostDataServer sets the host data server.
func (*Manager) SetHostPluginsServer ¶
func (m *Manager) SetHostPluginsServer(server HostPluginsServer)
SetHostPluginsServer sets the host plugins server.
func (*Manager) SetPluginFactory ¶
func (m *Manager) SetPluginFactory(factory PluginFactory)
SetPluginFactory sets the plugin factory.
func (*Manager) SetPublisher ¶
func (m *Manager) SetPublisher(pub domainevents.Publisher)
SetPublisher sets the event publisher for plugin lifecycle events.
func (*Manager) SetSystemInfo ¶
func (m *Manager) SetSystemInfo(info *pluginv1.SystemInfo)
SetSystemInfo sets the system information to pass to plugins during initialization. This should be called before loading plugins so they can receive hardware/system details.
func (*Manager) StartHealthMonitor ¶
StartHealthMonitor starts a background goroutine that monitors plugin health.
func (*Manager) UnloadPlugin ¶
UnloadPlugin gracefully shuts down and removes a plugin.
func (*Manager) UnregisterPlugin ¶
UnregisterPlugin removes a plugin instance from the manager.
type ManagerConfig ¶
type ManagerConfig struct {
// PluginDir is the directory containing plugin binaries.
PluginDir string
// StorageDir is the base directory for plugin data storage.
StorageDir string
// HostVersion is the ViewRA version for compatibility checking.
HostVersion string
// HealthCheckInterval is how often to check plugin health.
// Defaults to 30 seconds if not set.
HealthCheckInterval time.Duration
// MaxRestarts is the maximum number of automatic restarts for a crashed plugin.
// Defaults to 3 if not set.
MaxRestarts int
// HostStorageServer provides KV storage for plugins.
// If nil, plugins will not be able to use host storage.
HostStorageServer HostStorageServer
// HostWeatherServer provides weather context for plugins.
// If nil, plugins will not receive weather-based context enrichment.
HostWeatherServer HostWeatherServer
// HostRatingsServer provides user ratings access for plugins.
// If nil, plugins will not be able to access user ratings.
HostRatingsServer HostRatingsServer
// HostProgressServer provides watch progress access for plugins.
// If nil, plugins will not be able to access watch history.
HostProgressServer HostProgressServer
}
ManagerConfig configures the plugin manager.
type PluginFactory ¶
type PluginFactory interface {
// NewPluginCoreGRPCPlugin creates a new PluginCoreGRPCPlugin.
NewPluginCoreGRPCPlugin() plugin.Plugin
// NewEnricherGRPCPlugin creates a new EnricherGRPCPlugin.
NewEnricherGRPCPlugin() plugin.Plugin
// NewPluginProviderGRPCPlugin creates a new PluginProviderGRPCPlugin.
NewPluginProviderGRPCPlugin() plugin.Plugin
// NewHostDataGRPCPlugin creates a new HostDataGRPCPlugin.
NewHostDataGRPCPlugin(impl HostDataServer, logger *slog.Logger) plugin.Plugin
// NewHostStorageGRPCPlugin creates a new HostStorageGRPCPlugin.
NewHostStorageGRPCPlugin(impl HostStorageServer, pluginID string, logger *slog.Logger) plugin.Plugin
// NewHostWeatherGRPCPlugin creates a new HostWeatherGRPCPlugin.
NewHostWeatherGRPCPlugin(impl HostWeatherServer, logger *slog.Logger) plugin.Plugin
// NewHostPluginsGRPCPlugin creates a new HostPluginsGRPCPlugin.
NewHostPluginsGRPCPlugin(impl HostPluginsServer, logger *slog.Logger) plugin.Plugin
// NewHostRatingsGRPCPlugin creates a new HostRatingsGRPCPlugin.
NewHostRatingsGRPCPlugin(impl HostRatingsServer, logger *slog.Logger) plugin.Plugin
// NewHostProgressGRPCPlugin creates a new HostProgressGRPCPlugin.
NewHostProgressGRPCPlugin(impl HostProgressServer, logger *slog.Logger) plugin.Plugin
// NewVectorSearchGRPCPlugin creates a new VectorSearchGRPCPlugin for client-side dispensing.
NewVectorSearchGRPCPlugin() plugin.Plugin
// NewTrendingProviderGRPCPlugin creates a new TrendingProviderGRPCPlugin for client-side dispensing.
NewTrendingProviderGRPCPlugin() plugin.Plugin
// GetBrokerID extracts the broker ID from a dispensed broker info struct.
GetBrokerID(brokerInfo interface{}) uint32
}
PluginFactory creates go-plugin Plugin instances. This interface allows the manager package to create plugins without importing the parent plugins package, avoiding circular dependencies.