plugin

package
v1.3.3 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2018 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNoType is returned when no type is specified
	ErrNoType = errors.New("plugin: no type")
	// ErrNoPluginID is returned when no id is specified
	ErrNoPluginID = errors.New("plugin: no id")
)

Functions

func Register

func Register(r *Registration)

Register allows plugins to register

Types

type InitContext

type InitContext struct {
	Config interface{}
	Path   string
	Root   string
}

InitContext is used for plugin inititalization

func NewContext

func NewContext(r *Registration, path string) *InitContext

type Registration

type Registration struct {
	// Type of the plugin
	Type Type
	// ID of the plugin
	ID string
	// Config specific to the plugin
	Config interface{}

	// InitFn is called when initializing a plugin.
	InitFn func(*InitContext) (interface{}, error)
}

Registration contains information for registering a plugin

func ForType

func ForType(t Type) []*Registration

func Get

func Get(t Type, id string) *Registration

func (*Registration) Init

func (r *Registration) Init(ic *InitContext) (interface{}, error)

Init the registered plugin

func (*Registration) URI

func (r *Registration) URI() string

URI returns the full plugin URI

type Type

type Type string

Type is the type of the plugin

const (
	// TestSuitePlugin implements a test suite
	TestSuitePlugin Type = "aragorn.testsuite.v1"
	// NotifierPlugin implements a notifier
	NotifierPlugin Type = "aragorn.notifier.v1"
)

func (Type) String

func (t Type) String() string

Jump to

Keyboard shortcuts

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