pluggable

package
v0.31.2 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2021 License: Apache-2.0 Imports: 15 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entry

type Entry interface {
	GetName() string
	GetPluginSubKey() string
	GetConfig() interface{}
}

Entry defines a configuration entry for an item that that can be managed by a plugin.

type PluginLoader

type PluginLoader struct {
	*config.Config

	SelectedPluginKey    *plugins.PluginKey
	SelectedPluginConfig interface{}
}

PluginLoader handles finding, configuring and loading porter plugins.

func NewPluginLoader

func NewPluginLoader(c *config.Config) *PluginLoader

func (*PluginLoader) Load

func (l *PluginLoader) Load(pluginType PluginTypeConfig) (interface{}, func(), error)

Load a plugin, returning the plugin's interface which the caller must then cast to the typed interface, a cleanup function to stop the plugin when finished communicating with it, and an error if the plugin could not be loaded.

type PluginTypeConfig

type PluginTypeConfig struct {
	// Name of the plugin type interface.
	Interface string

	// Plugin to communicate with the plugin
	Plugin plugin.Plugin

	// GetDefaultPluggable is the function on porter's config.Data
	// to retrieve a pluggable configuration value's named default instance to use, e.g. "default-storage"
	GetDefaultPluggable func(datastore *config.Data) string

	// GetPluggable is the function on porter's config.Data
	// to retrieve a named pluggable instance, e.g. a storage named "azure"
	GetPluggable func(datastore *config.Data, name string) (Entry, error)

	// GetDefaultPlugin is the function on porter's config.Data
	// to retrieve the default plugin to use for a type of plugin, e.g. "storage-plugin"
	GetDefaultPlugin func(datastore *config.Data) string
}

PluginTypeConfig defines a set of functions to access a type of plugin's data in the porter config file.

Jump to

Keyboard shortcuts

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