drivermanager

package
v0.11.2 Latest Latest
Warning

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

Go to latest
Published: May 28, 2020 License: MPL-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrDriverNotFound = fmt.Errorf("driver not found")

ErrDriverNotFound is returned during Dispense when the requested driver plugin is not found in the plugin catalog

Functions

func New

func New(c *Config) *manager

New returns a new driver manager

Types

type Config

type Config struct {
	// Logger is the logger used by the device manager
	Logger log.Logger

	// Loader is the plugin loader
	Loader loader.PluginCatalog

	// PluginConfig is the config passed to the launched plugins
	PluginConfig *base.AgentConfig

	// Updater is used to update the node when driver information changes
	Updater UpdateNodeDriverInfoFn

	// EventHandlerFactory is used to retrieve a task event handler
	EventHandlerFactory TaskEventHandlerFactory

	// State is used to manage the device managers state
	State StateStorage

	// AllowedDrivers if set will only start driver plugins for the given
	// drivers
	AllowedDrivers map[string]struct{}

	// BlockedDrivers if set will not allow the given driver plugins to start
	BlockedDrivers map[string]struct{}
}

Config is used to configure a driver manager

type EventHandler

type EventHandler func(*drivers.TaskEvent)

EventHandler is a callback to be called for a task. The handler should not block execution.

type FetchPluginReattachFn

type FetchPluginReattachFn func() (*plugin.ReattachConfig, bool)

FetchPluginReattachFn is used to retrieve the stored plugin reattachment configuration.

type Manager

type Manager interface {
	pluginmanager.PluginManager

	// Dispense returns a drivers.DriverPlugin for the given driver plugin name
	// handling reattaching to an existing driver if available
	Dispense(driver string) (drivers.DriverPlugin, error)
}

Manager is the interface used to manage driver plugins

func TestDriverManager

func TestDriverManager(t *testing.T) Manager

type StateStorage

type StateStorage interface {
	// GetDevicePluginState is used to retrieve the device manager's plugin
	// state.
	GetDriverPluginState() (*state.PluginState, error)

	// PutDevicePluginState is used to store the device manager's plugin
	// state.
	PutDriverPluginState(state *state.PluginState) error
}

StateStorage is used to persist the driver managers state across agent restarts.

type StorePluginReattachFn

type StorePluginReattachFn func(*plugin.ReattachConfig) error

StorePluginReattachFn is used to store plugin reattachment configurations.

type TaskEventHandlerFactory

type TaskEventHandlerFactory func(allocID, taskName string) EventHandler

TaskEventHandlerFactory returns an event handler for a given allocID/task name

type TaskExecHandler added in v0.9.2

type TaskExecHandler func(
	ctx context.Context,
	command []string,
	tty bool,
	stream drivers.ExecTaskStream) error

TaskExecHandler is function to be called for executing commands in a task

type UpdateNodeDriverInfoFn

type UpdateNodeDriverInfoFn func(string, *structs.DriverInfo)

UpdateNodeDriverInfoFn is the callback used to update the node from fingerprinting

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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