manager

package
v0.12.0-beta.1 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotCompliant = errors.New("plugin not compliant")

ErrNotCompliant is returned by Manager.Run when the plugin is found but not compliant.

View Source
var ErrNotFound = errors.New("plugin not found")

ErrNotFound is returned by Manager.Get and Manager.Run when the plugin is not found.

Functions

This section is empty.

Types

type Manager

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

Manager manages plugins installed on the system.

func New

func New(roots ...string) *Manager

New returns a new manager rooted at root.

roots is the path of the directories where plugins are stored following the {root}/{plugin-name}/notation-{plugin-name}[.exe] pattern.

if roots is not set, it uses the build in directory structure.

func (*Manager) Get

func (mgr *Manager) Get(ctx context.Context, name string) (*Plugin, error)

Get returns a plugin on the system by its name.

If the plugin is not found, the error is of type ErrNotFound. The plugin might be incomplete if p.Err is not nil.

func (*Manager) List

func (mgr *Manager) List(ctx context.Context) ([]*Plugin, error)

List produces a list of the plugins available on the system.

Some plugins might be incomplete if their Err is not nil.

func (*Manager) Runner

func (mgr *Manager) Runner(name string) (plugin.Runner, error)

Runner returns a plugin.Runner.

If the plugin is not found or is not a valid candidate, the error is of type ErrNotFound.

type Plugin

type Plugin struct {
	plugin.Metadata

	Path string `json:",omitempty"`

	// Err is non-nil if the plugin failed one of the candidate tests.
	Err error `json:",omitempty"`
}

Plugin represents a potential plugin with all it's metadata.

Jump to

Keyboard shortcuts

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