plugin

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package plugin handles loading and management of check plugins.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNoPluginsDirectory is returned when the plugins directory does not exist.
	ErrNoPluginsDirectory = errors.New("plugins directory does not exist")
	// ErrNoPluginsLoaded is returned when no plugins were successfully loaded.
	ErrNoPluginsLoaded = errors.New("no plugins loaded")
)

Functions

This section is empty.

Types

type Registry

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

Registry holds all loaded plugins.

func NewRegistry

func NewRegistry(logger *slog.Logger) *Registry

NewRegistry creates a new plugin registry.

func (*Registry) All

func (r *Registry) All() map[string]check.Check

All returns all registered checks.

func (*Registry) Configs

func (r *Registry) Configs() map[string]map[string]any

Configs returns all plugin configurations.

func (*Registry) Filter

func (r *Registry) Filter(names []string) []check.Check

Filter returns checks matching the given names (or all if empty).

func (*Registry) Get

func (r *Registry) Get(name string) check.Check

Get returns a check by name.

func (*Registry) GetConfig

func (r *Registry) GetConfig(name string) map[string]any

GetConfig returns the per-plugin configuration from viper.

func (*Registry) LoadDirectory

func (r *Registry) LoadDirectory(dir string) error

LoadDirectory loads all plugins from a directory. Returns ErrNoPluginsDirectory if the directory does not exist.

func (*Registry) LoadPlugin

func (r *Registry) LoadPlugin(path string) error

LoadPlugin loads a single plugin from a .so file.

func (*Registry) Names

func (r *Registry) Names() []string

Names returns all registered check names.

func (*Registry) Register

func (r *Registry) Register(c check.Check)

Register adds a check to the registry.

func (*Registry) SetConfig

func (r *Registry) SetConfig(name string, cfg map[string]any)

SetConfig sets the per-plugin configuration.

Jump to

Keyboard shortcuts

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