2018-11-27 04:40:55 +00:00
|
|
|
package pluginmanager
|
|
|
|
|
2018-12-13 06:41:44 +00:00
|
|
|
import "context"
|
|
|
|
|
2018-11-27 04:40:55 +00:00
|
|
|
// PluginManager orchestrates the lifecycle of a set of plugins
|
|
|
|
type PluginManager interface {
|
2018-12-13 06:41:44 +00:00
|
|
|
// Run starts a plugin manager and should return early
|
2018-11-27 04:40:55 +00:00
|
|
|
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
|
|
|
|
}
|
2018-12-13 06:41:44 +00:00
|
|
|
|
|
|
|
// FingerprintingPluginManager is an interface that exposes fingerprinting
|
|
|
|
// coordination for plugin managers
|
|
|
|
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{}
|
|
|
|
}
|