plugin

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

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

Go to latest
Published: Dec 15, 2023 License: AGPL-3.0 Imports: 6 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidRegisterFunc is returned when the plugin package
	// could not find the expected RegisterPlugin func in the loaded
	// plugin.
	ErrInvalidRegisterFunc = errors.New("invalid register func")
	// ErrInvalidPlugin is returned when a loaded plugin does
	// not match the expected interface.
	ErrInvalidPlugin = errors.New("invalid plugin")
	// ErrPluginNotFound is returned when the given plugin could
	// not be found in the registry.
	ErrPluginNotFound = errors.New("plugin not found")
)

Functions

This section is empty.

Types

type IteratorFunc

type IteratorFunc func(plg Plugin) error

type Plugin

type Plugin interface {
	PluginName() string
	PluginVersion() string
}

type Registry

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

func NewRegistry

func NewRegistry() *Registry

func (*Registry) Add

func (r *Registry) Add(plg Plugin)

func (*Registry) Each

func (r *Registry) Each(iterator IteratorFunc) error

func (*Registry) Get

func (r *Registry) Get(name string) (Plugin, error)

func (*Registry) Load

func (r *Registry) Load(ctx context.Context, path string) (Plugin, error)

func (*Registry) LoadAll

func (r *Registry) LoadAll(ctx context.Context, pattern string) ([]Plugin, error)

func (*Registry) Plugins

func (r *Registry) Plugins() []Plugin

Jump to

Keyboard shortcuts

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