plugin

package
v0.0.0-...-4cbe793 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

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

Manager handles plugin lifecycle and communication

func NewManager

func NewManager(logger logger.Logger) *Manager

NewManager creates a new plugin manager

func (*Manager) GetPlugin

func (m *Manager) GetPlugin(name string) (Plugin, bool)

GetPlugin retrieves a plugin by name

func (*Manager) ListPlugins

func (m *Manager) ListPlugins() []string

ListPlugins returns a list of loaded plugins

func (*Manager) LoadPlugin

func (m *Manager) LoadPlugin(path string, config map[string]interface{}) error

LoadPlugin loads a plugin from a .so file

func (*Manager) Process

func (m *Manager) Process(ctx context.Context, data interface{}) error

Process sends data to all plugins

func (*Manager) Shutdown

func (m *Manager) Shutdown(ctx context.Context) error

Shutdown gracefully shuts down all plugins

type Plugin

type Plugin interface {
	// Initialize sets up the plugin
	Initialize(ctx context.Context, config map[string]interface{}) error

	// Name returns the plugin's name
	Name() string

	// Version returns the plugin's version
	Version() string

	// Type returns the plugin type (output, analysis, processor)
	Type() string

	// Process handles incoming data
	Process(ctx context.Context, data interface{}) error

	// Shutdown cleans up plugin resources
	Shutdown(ctx context.Context) error
}

Plugin defines the interface that all plugins must implement

Jump to

Keyboard shortcuts

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