singleton

package
v0.9.0-beta3 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2019 License: MPL-2.0 Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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