Documentation
¶
Overview ¶
Package pluginapi provides the plugin interface for Hockeypuck with Interpose support
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EventBus ¶
type EventBus struct {
// contains filtered or unexported fields
}
EventBus handles event publishing and subscription
func NewEventBus ¶
func NewEventBus() *EventBus
func (*EventBus) Publish ¶
func (eb *EventBus) Publish(event PluginEvent) error
type HandlerPlugin ¶
type HandlerPlugin interface {
Plugin
// Routes returns the routes this plugin wants to register
Routes() []PluginRoute
}
HandlerPlugin is implemented by plugins that provide HTTP handlers
type Logger ¶
type Logger interface {
Debug(msg string, args ...interface{})
Info(msg string, args ...interface{})
Warn(msg string, args ...interface{})
Error(msg string, args ...interface{})
}
Logger interface for plugin logging
type MiddlewarePlugin ¶
type MiddlewarePlugin interface {
Plugin
// Middleware returns the middleware function for Interpose
// Priority determines the order (lower numbers run first)
Middleware() (func(http.Handler) http.Handler, int)
}
MiddlewarePlugin is implemented by plugins that provide HTTP middleware
type Plugin ¶
type Plugin interface {
// Initialize the plugin with server context and configuration
Initialize(ctx context.Context, host PluginHost, config map[string]interface{}) error
// Name returns the unique plugin identifier
Name() string
// Version returns the plugin version
Version() string
// Description returns human-readable plugin description
Description() string
// Dependencies returns required plugin dependencies
Dependencies() []PluginDependency
// Shutdown gracefully stops the plugin
Shutdown(ctx context.Context) error
}
Plugin is the base interface that all plugins must implement
type PluginDependency ¶
PluginDependency represents a plugin dependency
type PluginEvent ¶
PluginEvent represents an event in the plugin system
type PluginHost ¶
type PluginHost interface {
// Access storage backend
Storage() interface{}
// Access configuration
Config() interface{}
// Access metrics system
Metrics() interface{}
// Register periodic tasks
RegisterTask(name string, interval time.Duration, task func(context.Context) error) error
// Publish events to plugin system
PublishEvent(event PluginEvent) error
// Subscribe to plugin events
SubscribeEvent(eventType string, handler func(PluginEvent) error) error
// Logger returns the plugin logger
Logger() Logger
}
PluginHost provides server context and services to plugins
type PluginManager ¶
type PluginManager struct {
// contains filtered or unexported fields
}
PluginManager manages plugin lifecycle with Interpose
func NewPluginManager ¶
func NewPluginManager(middleware *interpose.Middleware, logger Logger) *PluginManager
NewPluginManager creates a new plugin manager
func (*PluginManager) GetRoutes ¶
func (pm *PluginManager) GetRoutes() map[string]http.HandlerFunc
GetRoutes returns all registered routes
func (*PluginManager) LoadPlugin ¶
func (pm *PluginManager) LoadPlugin(ctx context.Context, plugin Plugin, config map[string]interface{}) error
LoadPlugin loads and initializes a plugin
type PluginRoute ¶
type PluginRoute struct {
Pattern string
Handler http.HandlerFunc
Methods []string // If empty, accepts all methods
}
PluginRoute defines a route that a plugin wants to register