Documentation ¶
Overview ¶
PluginManger manages loading, unloading, and swapping of plugins
Router is the entry point for execution commands and routing to plugins
Index ¶
- Constants
- Variables
- func MonitorDurationOption(v time.Duration) monitorOption
- func New(opts ...ControlOpt) *pluginControl
- func NewConfig() *config
- func OptSetPluginConfig(cf *pluginConfig) pluginManagerOpt
- type ControlOpt
- type MTTrie
- func (mtt MTTrie) Add(mt *metricType)
- func (m *MTTrie) DeleteByPlugin(lp *loadedPlugin)
- func (mtt MTTrie) Fetch(ns []string) ([]*metricType, perror.PulseError)
- func (mtt MTTrie) Get(ns []string) ([]*metricType, perror.PulseError)
- func (mtt MTTrie) Remove(ns []string) perror.PulseError
- func (m *MTTrie) RemoveMetric(mt metricType)
- func (m *MTTrie) String() string
- type RouterResponse
- type RoutingStrategy
Constants ¶
const ( // DefaultClientTimeout - default timeout for a client connection attempt DefaultClientTimeout = time.Second * 3 // DefaultHealthCheckTimeout - default timeout for a health check DefaultHealthCheckTimeout = time.Second * 1 // DefaultHealthCheckFailureLimit - how any consecutive health check timeouts must occur to trigger a failure DefaultHealthCheckFailureLimit = 3 )
const ( PluginTrustDisabled int = iota PluginTrustEnabled PluginTrustWarn )
const ( MonitorStopped monitorState = iota - 1 // default is stopped MonitorStarted // Changed to one second until we get proper control of duration runtime into this. DefaultMonitorDuration = time.Second * 1 )
const ( // loadedPlugin States DetectedState pluginState = "detected" LoadingState pluginState = "loading" LoadedState pluginState = "loaded" UnloadedState pluginState = "unloaded" )
const ( HandlerRegistrationName = "control.runner" // availablePlugin States PluginRunning availablePluginState = iota - 1 // Default value (0) is Running PluginStopped PluginDisabled )
Variables ¶
var ( ErrPoolNotFound = errors.New("plugin pool not found") ErrBadKey = errors.New("bad key") ErrBadType = errors.New("bad plugin type") )
var ( ErrLoadedPluginNotFound = errors.New("Loaded plugin not found") ErrControllerNotStarted = errors.New("Must start Controller before calling Load()") )
var ( ErrPluginNotFound = errors.New("plugin not found") ErrPluginAlreadyLoaded = errors.New("plugin is already loaded") ErrPluginNotInLoadedState = errors.New("Plugin must be in a LoadedState") )
var ErrNotFound = errors.New("metric not found")
ErrNotFound is returned when Get cannot find the given namespace
Functions ¶
func MonitorDurationOption ¶
MonitorDuration sets monitor's duration to v.
func OptSetPluginConfig ¶
func OptSetPluginConfig(cf *pluginConfig) pluginManagerOpt
Types ¶
type ControlOpt ¶
type ControlOpt func(*pluginControl)
func CacheExpiration ¶
func CacheExpiration(t time.Duration) ControlOpt
func MaxRunningPlugins ¶
func MaxRunningPlugins(m int) ControlOpt
func OptSetConfig ¶
func OptSetConfig(cfg *config) ControlOpt
type MTTrie ¶
type MTTrie struct {
// contains filtered or unexported fields
}
The root in the trie
func (MTTrie) Add ¶
func (mtt MTTrie) Add(mt *metricType)
Add adds a node with the given namespace with the given MetricType
func (*MTTrie) DeleteByPlugin ¶
func (m *MTTrie) DeleteByPlugin(lp *loadedPlugin)
Remove all metrics from the catalog if they match a loadedPlugin
func (MTTrie) Fetch ¶
func (mtt MTTrie) Fetch(ns []string) ([]*metricType, perror.PulseError)
Collect collects all children below a given namespace and concatenates their metric types into a single slice
func (MTTrie) Get ¶
func (mtt MTTrie) Get(ns []string) ([]*metricType, perror.PulseError)
Get works like fetch, but only returns the MT at the given node and does not gather the node's children.
func (MTTrie) Remove ¶
func (mtt MTTrie) Remove(ns []string) perror.PulseError
Remove removes all children below a given namespace
func (*MTTrie) RemoveMetric ¶
func (m *MTTrie) RemoveMetric(mt metricType)
Removes a specific metric by namespace and version from the tree
type RouterResponse ¶
type RouterResponse interface { }
type RoutingStrategy ¶
type RoutingStrategy interface { Select(routing.SelectablePluginPool, []routing.SelectablePlugin) (routing.SelectablePlugin, error) // Handy string for logging what strategy is selected String() string }