plugins

package
v3.16.3 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Package plugins exists mainly to prevent a cycle when plugins need to use "app"

Index

Constants

This section is empty.

Variables

View Source
var InternalPlugins internalPluginMapping

InternalPlugins provides information about all the internal plugins keyed first by type and then by key

Functions

This section is empty.

Types

type ActivatedLifecycler

type ActivatedLifecycler struct {
	*ActivatedPlugin
	Lifecycler iscenv.Lifecycler
}

ActivatedLifecycler holds information about a lifecycler plugin that has been activated

type ActivatedPlugin

type ActivatedPlugin struct {
	Id     string
	Path   string
	Plugin interface{}
}

ActivatedPlugin holds information about a plugin that has been activated

type ActivatedVersioner

type ActivatedVersioner struct {
	*ActivatedPlugin
	Versioner iscenv.Versioner
}

ActivatedVersioner holds information about a versioner plugin that has been activated

type InternalPlugin

type InternalPlugin interface {
	// Start the plugin
	Main()
	Key() string
}

InternalPlugin is an API for starting internal plugins

type LifecyclerManager

type LifecyclerManager struct {
	*PluginManager
}

LifecyclerManager is a PluginManager for managing lifecycler plugins

func NewLifecyclerManager

func NewLifecyclerManager(args PluginArgs) (*LifecyclerManager, error)

NewLifecyclerManager creates and returns a PluginManager for a LifecyclerPlugin

func (*LifecyclerManager) ActivatePlugins

func (lm *LifecyclerManager) ActivatePlugins(pluginsToActivate []string) ([]*ActivatedLifecycler, error)

ActivatePlugins will activate the provided list of lifecycler plugins.

type PluginArgs

type PluginArgs struct {
	LogLevel string
	LogJSON  bool
}

PluginArgs holds information about the arguments for a plugin

func (PluginArgs) ToArgs

func (pa PluginArgs) ToArgs() []string

ToArgs returns a slice of strings representing the command arguments for a plugin

type PluginClient

type PluginClient struct {
	ExecutablePath string
	*plugin.Client
}

PluginClient holds path to the executable and client for a plugin

func (*PluginClient) RPCClient

func (pc *PluginClient) RPCClient() (plugin.ClientProtocol, error)

RPCClient is needed because the embedded struct is Client and it has a function called Client so it's client.Client() is ambiguous

type PluginManager

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

PluginManager holds the type of the plugin and a map of the clients

func NewPluginManager

func NewPluginManager(pluginType string, iscenvPlugin plugin.Plugin, args PluginArgs) (*PluginManager, error)

NewPluginManager creates and returns a PluginManager for the requested Plugin

func (*PluginManager) ActivatePlugins

func (pm *PluginManager) ActivatePlugins(pluginsToActivate []string) ([]*ActivatedPlugin, error)

ActivatePlugins will activate the provided list of plugins. If the list is nil, it will activate all of the plugins. It does this by traversing all of the plugins dispensing them to the rpc client and then returning an object containing the Id of the plugin, the path to the executable (if not internal) and the raw plugin interface{} which the caller will likely want to typecast into something more useful. It will return the ActivatedPlugins in the same order as the pluginsToActivate and any error encountered

func (*PluginManager) AvailablePlugins

func (pm *PluginManager) AvailablePlugins() []string

AvailablePlugins returns a slice of the keys of all of the discovered plugins

func (*PluginManager) Close

func (pm *PluginManager) Close()

Close will shut down all the PluginClients

type VersionerManager

type VersionerManager struct {
	*PluginManager
}

VersionerManager is a PluginManager for managing versioner plugins

func NewVersionerManager

func NewVersionerManager(args PluginArgs) (*VersionerManager, error)

NewVersionerManager creates and returns a PluginManager for a VersionerPlugin

func (*VersionerManager) ActivatePlugins

func (lm *VersionerManager) ActivatePlugins(pluginsToActivate []string) ([]*ActivatedVersioner, error)

ActivatePlugins will activate the provided list of versioner plugins.

Jump to

Keyboard shortcuts

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