inproc

package
v0.0.0-...-a355528 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2017 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultExecName is the default exec name to identify this launcher in the config
	DefaultExecName = "inproc"
)
View Source
const (
	// ExecName is the name to use in the launch rule configs
	ExecName = "inproc"
)

Variables

This section is empty.

Functions

func Register

func Register(lookup string, prf PluginRunFunc, defaultOptions interface{})

Register registers helper function with the plugin lookup name

func Rules

func Rules() []launch.Rule

Rules returns a list of default launch rules. This is a set of rules required by the monitor

Types

type Launcher

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

Launcher is a service that implements the launch.Exec interface for starting up os processes.

func NewLauncher

func NewLauncher(n string, plugins func() discovery.Plugins) (*Launcher, error)

NewLauncher returns a Launcher that can install and start plugins. The inproc launcher will start up the plugin in process.

func (*Launcher) Exec

func (l *Launcher) Exec(key string, pn plugin.Name,
	config *types.Any) (pluginName plugin.Name, starting <-chan error, err error)

Exec starts the os process. Returns a signal channel to block on optionally. The channel is closed as soon as an error (or nil for success completion) is written. The command is run in the background / asynchronously. The returned read channel stops blocking as soon as the command completes. However, the plugin is running in process.

func (*Launcher) Name

func (l *Launcher) Name() string

Name returns the name of the launcher

type PluginRunFunc

type PluginRunFunc func(func() discovery.Plugins, plugin.Name,
	*types.Any) (transport plugin.Transport, plugins map[run.PluginCode]interface{}, onStop func(), err error)

PluginRunFunc is a function that takes the plugin lookup, a configuration blob and starts the plugin and returns a stoppable, running channel (for optionally blocking), and error.

type Rule

type Rule struct {

	// Kind is the canonical name that are defined for each package under pkg/run/v[0-9]+.
	// Kind is an organization of multiple plugin's. For example, there is a kubernetes Kind and this
	// would correspond to pkg/types/Spec.Kind.  This is used to identify the subsystem to start (e.g. kubernetes).
	// However, it is possible to have multiple instances of objects in a same Kind.  For example, for aws Kind,
	// it's possible to have two instance plugins, one called us-west-1a and one us-west-2a. So the kind is aws,
	// but the lookup name for discovery (which plugin.Name is used), would be us-west-1a.sock and us-west-1b.sock,
	// and each endpoint would have multiple objects (e.g. us-west-1a/ec2-instance and us-west-1b/ec2-instance).
	Kind    string
	Options *types.Any
}

Rule is the rule for starting an inproc plugin.

Jump to

Keyboard shortcuts

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