plugin

package
v0.0.0-...-44dad58 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

Functions

This section is empty.

Types

type InitContext

type InitContext struct {
	Context    context.Context
	Config     interface{}
	Client     clientset.Interface
	Informer   informers.SharedInformerFactory
	VCClient   vcclient.Interface
	VCInformer vcinformers.VirtualClusterInformer
}

InitContext is used for plugin initialization

type Plugin

type Plugin struct {
	Registration *Registration // registration, as initialized
	// contains filtered or unexported fields
}

Plugin represents an initialized plugin, used with an init context.

func (*Plugin) Instance

func (p *Plugin) Instance() (interface{}, error)

Instance returns the instance and any initialization error of the plugin

type Registration

type Registration struct {
	// ID of the plugin
	ID string

	// InitFn is called when initializing a plugin. The registration and
	// context are passed in.
	InitFn func(*InitContext) (interface{}, error)
	// Disable the plugin from loading
	Disable bool
}

Registration contains information for registering a plugin

func (*Registration) Init

func (r *Registration) Init(ic *InitContext) *Plugin

Init the registered plugin

type ResourceRegister

type ResourceRegister struct {
	sync.RWMutex
	// contains filtered or unexported fields
}
var SyncerResourceRegister ResourceRegister

func (*ResourceRegister) List

func (reg *ResourceRegister) List() []*Registration

List returns the list of registered plugins for initialization.

func (*ResourceRegister) Register

func (reg *ResourceRegister) Register(r *Registration)

Register allows plugins to register

Jump to

Keyboard shortcuts

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