pluginmanager

package
v0.9.4 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2019 License: MPL-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FingerprintingPluginManager

type FingerprintingPluginManager interface {
	PluginManager

	// WaitForFirstFingerprint returns a channel that is closed once all plugin
	// instances managed by the plugin manager have fingerprinted once. A
	// context can be passed which when done will also close the channel
	WaitForFirstFingerprint(context.Context) <-chan struct{}
}

FingerprintingPluginManager is an interface that exposes fingerprinting coordination for plugin managers

type MockPluginManager

type MockPluginManager struct {
	RunF      func()
	ShutdownF func()
}

func (*MockPluginManager) PluginType

func (m *MockPluginManager) PluginType() string

func (*MockPluginManager) Run

func (m *MockPluginManager) Run()

func (*MockPluginManager) Shutdown

func (m *MockPluginManager) Shutdown()

type PluginGroup

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

PluginGroup is a utility struct to manage a collectively orchestrate a set of PluginManagers

func New

func New(logger log.Logger) *PluginGroup

New returns an initialized PluginGroup

func (*PluginGroup) RegisterAndRun

func (m *PluginGroup) RegisterAndRun(manager PluginManager) error

RegisterAndRun registers the manager and starts it in a separate goroutine

func (*PluginGroup) Shutdown

func (m *PluginGroup) Shutdown()

Shutdown shutsdown all registered PluginManagers in reverse order of how they were started.

func (*PluginGroup) WaitForFirstFingerprint

func (m *PluginGroup) WaitForFirstFingerprint(ctx context.Context) (<-chan struct{}, error)

Ready returns a channel which will be closed once all plugin managers are ready. A timeout for waiting on each manager is given

type PluginManager

type PluginManager interface {
	// Run starts a plugin manager and should return early
	Run()

	// Shutdown should gracefully shutdown all plugins managed by the manager.
	// It must block until shutdown is complete
	Shutdown()

	// PluginType is the type of plugin which the manager manages
	PluginType() string
}

PluginManager orchestrates the lifecycle of a set of plugins

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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