manager

package
v0.0.0-...-a9ed6da Latest Latest
Warning

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

Go to latest
Published: May 7, 2018 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Package manager encapsulates everything related to long running plugin manager that starts, stops & configures long running plugins

Package manager encapsulates everything related to long running plugin manager that starts, stops & configures long running plugins

Package manager encapsulates everything related to long running plugin manager that starts, stops & configures long running plugins

Package manager encapsulates everything related to long running plugin manager that starts, stops & configures long running plugins

Package manager encapsulates everything related to long running plugin manager that starts, stops & configures long running plugins

Index

Constants

View Source
const (
	//name is the core module name for long running plugins manager
	Name = "LongRunningPluginsManager"

	// NameOfCloudWatchJsonFile is the name of ec2 config cloudwatch local configuration file
	NameOfCloudWatchJsonFile = "AWS.EC2.Windows.CloudWatch.json"

	//number of long running workers
	NumberOfLongRunningPluginWorkers = 5

	//number of cancel workers
	NumberOfCancelWorkers = 5

	//poll frequency for managing lifecycle of long running plugins
	PollFrequencyMinutes = 15

	//hardStopTimeout is the time before the manager will be shutdown during a hardstop = 4 seconds
	HardStopTimeout = 4 * time.Second

	//softStopTimeout is the time before the manager will be shutdown during a softstop = 20 seconds
	SoftStopTimeout = 20 * time.Second
)
View Source
const CloudWatchId = "aws:cloudWatch"

CloudWatchId represents the ID of cloud watch plugin

Variables

This section is empty.

Functions

func CreateResult

func CreateResult(msg string, status contracts.ResultStatus, res *contracts.PluginResult)

func EnsureInitialization

func EnsureInitialization(context context.T)

EnsureManagerIsInitialized ensures that manager is initialized at least once

func Invoke

func Invoke(log logger.T, pluginID string, res *contracts.PluginResult, orchestrationDir string)

func RegisteredPlugins

func RegisteredPlugins(context context.T) map[string]plugin.Plugin

RegisteredPlugins loads all registered long running plugins in memory

Types

type Manager

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

Manager is the core module - that manages long running plugins

func GetInstance

func GetInstance() (*Manager, error)

GetInstance returns an instance of Manager if its initialized otherwise it returns an error

func (*Manager) EnsurePluginRegistered

func (m *Manager) EnsurePluginRegistered(name string, plugin managerContracts.Plugin) (err error)

EnsurePluginRegistered adds a long-running plugin if it is not already in the registry

func (*Manager) GetRegisteredPlugins

func (m *Manager) GetRegisteredPlugins() map[string]managerContracts.Plugin

GetRegisteredPlugins returns a map of all registered long running plugins

func (*Manager) ModuleExecute

func (m *Manager) ModuleExecute(context context.T) (err error)

Execute starts long running plugin manager

func (*Manager) ModuleName

func (m *Manager) ModuleName() string

Name returns the module name

func (*Manager) ModuleRequestStop

func (m *Manager) ModuleRequestStop(stopType contracts.StopType) (err error)

RequestStop handles the termination of the long running plugin manager

func (*Manager) StartPlugin

func (m *Manager) StartPlugin(name, configuration string, orchestrationDir string, cancelFlag task.CancelFlag, out iohandler.IOHandler) (err error)

StartPlugin starts the given plugin with the given configuration

func (*Manager) StopPlugin

func (m *Manager) StopPlugin(name string, cancelFlag task.CancelFlag) (err error)

StopPlugin stops a given plugin from executing

type Mock

type Mock struct {
	mock.Mock
}

Mock stands for a mocked manager.

func NewMockDefault

func NewMockDefault() *Mock

NewMockDefault returns an instance of Mock with default expectations set.

func (*Mock) EnsurePluginRegistered

func (m *Mock) EnsurePluginRegistered(name string, plugin managerContracts.Plugin) (err error)

EnsurePluginRegistered adds a long-running plugin if it is not already in the registry

func (*Mock) GetRegisteredPlugins

func (m *Mock) GetRegisteredPlugins() map[string]managerContracts.Plugin

GetRegisteredPlugins returns a map of all registered long running plugins - return the specified plugin map for testing here

func (*Mock) ModuleExecute

func (m *Mock) ModuleExecute(context context.T) (err error)

Execute starts long running plugin manager and returns encountered error - returns nil here for testing

func (*Mock) ModuleName

func (m *Mock) ModuleName() string

Name returns the module name

func (*Mock) ModuleRequestStop

func (m *Mock) ModuleRequestStop(stopType contracts.StopType) (err error)

RequestStop handles the termination of the message processor plugin job and returns encountered error - returns nil here for testing

func (*Mock) StartPlugin

func (m *Mock) StartPlugin(name, configuration, orchestrationDir string, cancelFlag task.CancelFlag, out iohandler.IOHandler) (err error)

StartPlugin starts the given plugin with the given configuration and returns encountered error - returns nil here for testing

func (*Mock) StopPlugin

func (m *Mock) StopPlugin(name string, cancelFlag task.CancelFlag) (err error)

StopPlugin stops a given plugin from executing and returns encountered error - returns nil here for testing

type T

type T interface {
	contracts.ICoreModule
	GetRegisteredPlugins() map[string]managerContracts.Plugin
	StopPlugin(name string, cancelFlag task.CancelFlag) (err error)
	StartPlugin(name, configuration string, orchestrationDir string, cancelFlag task.CancelFlag, out iohandler.IOHandler) (err error)
	EnsurePluginRegistered(name string, plugin managerContracts.Plugin) (err error)
}

T manages long running plugins - get information of long running plugins and starts, stops & configures long running plugins

Jump to

Keyboard shortcuts

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