plugin

package
v0.0.0-...-ec9e501 Latest Latest
Warning

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

Go to latest
Published: May 21, 2025 License: MIT, MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AlertPluginInterface

type AlertPluginInterface interface {
	// SendAlert sends an alert to a custom destination
	SendAlert(alert any, options map[string]any) error
}

AlertPluginInterface defines the interface for alert plugins

type ExportPluginInterface

type ExportPluginInterface interface {
	// Export exports data to a custom format
	Export(data any, options map[string]any) ([]byte, error)
}

ExportPluginInterface defines the interface for export plugins

type MetricPluginInterface

type MetricPluginInterface interface {
	// CollectMetrics collects custom metrics
	CollectMetrics(options map[string]any) (map[string]any, error)
}

MetricPluginInterface defines the interface for metric plugins

type Plugin

type Plugin struct {
	Info   PluginInfo     `json:"info"`
	Path   string         `json:"path"`
	Module *plugin.Plugin `json:"-"`
	Lookup map[string]any `json:"-"`
}

Plugin represents a loaded plugin

func (*Plugin) ExecuteFunc

func (p *Plugin) ExecuteFunc(name string, args ...any) ([]any, error)

ExecuteFunc executes a function in a plugin

func (*Plugin) LookupSymbol

func (p *Plugin) LookupSymbol(name string) (any, error)

LookupSymbol looks up a symbol in a plugin

type PluginInfo

type PluginInfo struct {
	Name        string     `json:"name"`
	Version     string     `json:"version"`
	Description string     `json:"description"`
	Author      string     `json:"author"`
	Type        PluginType `json:"type"`
	Enabled     bool       `json:"enabled"`
}

PluginInfo contains metadata about a plugin

type PluginManager

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

PluginManager manages the loading and execution of plugins

func NewPluginManager

func NewPluginManager() *PluginManager

NewPluginManager creates a new plugin manager

func (*PluginManager) DisablePlugin

func (m *PluginManager) DisablePlugin(name string) error

DisablePlugin disables a plugin

func (*PluginManager) EnablePlugin

func (m *PluginManager) EnablePlugin(name string) error

EnablePlugin enables a plugin

func (*PluginManager) GetPlugin

func (m *PluginManager) GetPlugin(name string) (*Plugin, error)

GetPlugin returns a loaded plugin by name

func (*PluginManager) ListPlugins

func (m *PluginManager) ListPlugins() []*Plugin

ListPlugins returns a list of all loaded plugins

func (*PluginManager) ListPluginsByType

func (m *PluginManager) ListPluginsByType(pluginType PluginType) []*Plugin

ListPluginsByType returns a list of loaded plugins of a specific type

func (*PluginManager) LoadPlugin

func (m *PluginManager) LoadPlugin(path string) (*Plugin, error)

LoadPlugin loads a plugin from a shared library file

func (*PluginManager) UnloadPlugin

func (m *PluginManager) UnloadPlugin(name string) error

UnloadPlugin unloads a plugin

type PluginType

type PluginType string

PluginType represents the type of plugin

const (
	// ValidationPlugin is a plugin that provides custom validation rules
	ValidationPlugin PluginType = "validation"
	// AlertPlugin is a plugin that provides custom alerting mechanisms
	AlertPlugin PluginType = "alert"
	// MetricPlugin is a plugin that provides custom metrics collection
	MetricPlugin PluginType = "metric"
	// StoragePlugin is a plugin that provides custom storage backends
	StoragePlugin PluginType = "storage"
	// ExportPlugin is a plugin that provides custom export formats
	ExportPlugin PluginType = "export"
	// UIPlugin is a plugin that provides custom UI components
	UIPlugin PluginType = "ui"
)

type StoragePluginInterface

type StoragePluginInterface interface {
	// Store stores data in a custom backend
	Store(key string, data any, options map[string]any) error
	// Retrieve retrieves data from a custom backend
	Retrieve(key string, options map[string]any) (any, error)
}

StoragePluginInterface defines the interface for storage plugins

type UIPluginInterface

type UIPluginInterface interface {
	// GetComponent returns a UI component
	GetComponent(name string, options map[string]any) (any, error)
}

UIPluginInterface defines the interface for UI plugins

type ValidationPluginInterface

type ValidationPluginInterface interface {
	// Validate validates data against custom rules
	Validate(data any, options map[string]any) (bool, string, error)
}

ValidationPluginInterface defines the interface for validation plugins

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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