singleton

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2019 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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")
)

Functions

This section is empty.

Types

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.

Jump to

Keyboard shortcuts

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