This section is empty.


View Source
var (
	// SingletonPluginExited is returned when the dispense is called and the
	// existing plugin has exited. The caller should retry, and this will issue
	// a new plugin instance.
	SingletonPluginExited = fmt.Errorf("singleton plugin exited")


This section is empty.


type SingletonLoader

type SingletonLoader struct {

	// contains filtered or unexported fields


SingletonLoader is used to only load a single external plugin at a time.

func NewSingletonLoader

func NewSingletonLoader(logger log.Logger, catalog loader.PluginCatalog) *SingletonLoader

NewSingletonLoader wraps a plugin catalog and provides singleton behavior on top by caching running instances.

func (*SingletonLoader) Catalog

func (s *SingletonLoader) Catalog() map[string][]*base.PluginInfoResponse

Catalog returns the catalog of all plugins keyed by plugin type

func (*SingletonLoader) Dispense

func (s *SingletonLoader) Dispense(name, pluginType string, config *base.AgentConfig, logger log.Logger) (loader.PluginInstance, error)

Dispense returns the plugin given its name and type. This will also configure the plugin. If there is an instance of an already running plugin, this is used.

func (*SingletonLoader) Reattach

func (s *SingletonLoader) Reattach(name, pluginType string, config *plugin.ReattachConfig) (loader.PluginInstance, error)

Reattach is used to reattach to a previously launched external plugin.