launch

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: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Exec

type Exec interface {

	// Name returns the name of the launcher.  This is used to identify
	// which launcher to use in configurations or command line flags
	Name() string

	// Exec starts the plugin given the name of the plugin and
	// the command and args to start it.
	// This can be an async process but the launcher will poll for the running
	// status of the plugin.
	// The client can receive and block on the returned channel
	// and add optional timeout in its own select statement.
	Exec(kind string, name plugin.Name, config *types.Any) (plugin.Name, <-chan error, error)
}

Exec is a service that is able to start plugins based on different mechanisms from running local binary to pulling and running docker containers or engine plugins

func NewNoOpExec

func NewNoOpExec() Exec

NewNoOpExec doesn't actually launch the plugins. It's a stub with no op and relies on manual plugin starts.

type ExecName

type ExecName string

ExecName is the name of the executor to use (e.g. 'os', 'docker-run', etc.). It's found in the config.

type Monitor

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

Monitor runs continuously receiving requests to start a plugin. Monitor uses a launcher to actually start the process of the plugin.

func NewMonitor

func NewMonitor(execs []Exec, rules []Rule) *Monitor

NewMonitor returns a monitor that continuously watches for input requests and launches the process for the plugin, if not already running. The configuration to use in the config is matched to the Name() of the executor (the field Exec).

func (*Monitor) Start

func (m *Monitor) Start() (chan<- StartPlugin, error)

Start starts the monitor and returns a channel for sending requests to launch plugins. Closing the channel effectively stops the monitor loop.

func (*Monitor) Stop

func (m *Monitor) Stop()

Stop stops the monitor

type Rule

type Rule struct {

	// Key is a string identifying which rule to use.  This can be used in the command line, e.g. plugin start.
	Key string

	// Launch is the rule for starting / launching the plugin. It's a dictionary with the key being
	// the name of the executor and the value being the properties used by that executor.
	Launch map[ExecName]*types.Any
}

Rule provides the instructions on starting the plugin

func MergeRules

func MergeRules(a, b []Rule) []Rule

MergeRules input rules into another slice

func (Rule) Merge

func (r Rule) Merge(o Rule) Rule

Merge input rule into receiver. If the input rule's plugin doesn't match the receiver's, the receiver value sees no changes.

type Rules

type Rules []Rule

Rules is a slice of rules

func (Rules) Len

func (r Rules) Len() int

func (Rules) Less

func (r Rules) Less(i, j int) bool

func (Rules) Swap

func (r Rules) Swap(i, j int)

type StartPlugin

type StartPlugin struct {
	Key     string
	Name    plugin.Name
	Exec    ExecName
	Options *types.Any // options that can override the defaults in the rules
	Started func(kind string, name plugin.Name, options *types.Any)
	Error   func(kind string, name plugin.Name, options *types.Any, err error)
}

StartPlugin is the command to start a plugin

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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