control

package
v0.9.0-beta Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2015 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Overview

PluginManger manages loading, unloading, and swapping of plugins

Router is the entry point for execution commands and routing to plugins

Index

Constants

View Source
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
)
View Source
const (
	PluginTrustDisabled int = iota
	PluginTrustEnabled
	PluginTrustWarn
)
View Source
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
)
View Source
const (
	// loadedPlugin States
	DetectedState pluginState = "detected"
	LoadingState  pluginState = "loading"
	LoadedState   pluginState = "loaded"
	UnloadedState pluginState = "unloaded"
)
View Source
const (
	HandlerRegistrationName = "control.runner"

	// availablePlugin States
	PluginRunning availablePluginState = iota - 1 // Default value (0) is Running
	PluginStopped
	PluginDisabled
)

Variables

View Source
var (
	ErrPoolNotFound = errors.New("plugin pool not found")
	ErrBadKey       = errors.New("bad key")
	ErrBadType      = errors.New("bad plugin type")
)
View Source
var (
	ErrLoadedPluginNotFound = errors.New("Loaded plugin not found")
	ErrControllerNotStarted = errors.New("Must start Controller before calling Load()")
)
View Source
var (
	ErrPluginNotFound         = errors.New("plugin not found")
	ErrPluginAlreadyLoaded    = errors.New("plugin is already loaded")
	ErrPluginNotInLoadedState = errors.New("Plugin must be in a LoadedState")
)
View Source
var ErrNotFound = errors.New("metric not found")

ErrNotFound is returned when Get cannot find the given namespace

Functions

func MonitorDurationOption

func MonitorDurationOption(v time.Duration) monitorOption

MonitorDuration sets monitor's duration to v.

func New

func New(opts ...ControlOpt) *pluginControl

New returns a new pluginControl instance

func NewConfig

func NewConfig() *config

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 NewMTTrie

func NewMTTrie() *MTTrie

New() returns an empty 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, serror.SnapError)

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, serror.SnapError)

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) serror.SnapError

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

func (*MTTrie) String

func (m *MTTrie) String() string

Handy print out of the tr(i)e

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
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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