device

package
v0.0.0-...-5a70286 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2020 License: MPL-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	SomeString        string `codec:"some_optional_string_with_default"`
	SomeBool          bool   `codec:"some_required_boolean"`
	SomeIntArray      []int  `codec:"some_optional_list"`
	FingerprintPeriod string `codec:"fingerprint_period"`
}

Config contains configuration information for the plugin.

type SkeletonDevicePlugin

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

SkeletonDevicePlugin contains a skeleton for most of the implementation of a device plugin.

func NewPlugin

func NewPlugin(log log.Logger) *SkeletonDevicePlugin

NewPlugin returns a device plugin, used primarily by the main wrapper

Plugin configuration isn't available yet, so there will typically be a limit to the initialization that can be performed at this point.

func (*SkeletonDevicePlugin) ConfigSchema

func (d *SkeletonDevicePlugin) ConfigSchema() (*hclspec.Spec, error)

ConfigSchema returns the configuration schema for the plugin.

This is called during Nomad client startup, immediately before parsing plugin config and calling SetConfig

func (*SkeletonDevicePlugin) Fingerprint

func (d *SkeletonDevicePlugin) Fingerprint(ctx context.Context) (<-chan *device.FingerprintResponse, error)

Fingerprint streams detected devices. Messages should be emitted to the returned channel when there are changes to the devices or their health.

func (*SkeletonDevicePlugin) PluginInfo

func (d *SkeletonDevicePlugin) PluginInfo() (*base.PluginInfoResponse, error)

PluginInfo returns information describing the plugin.

This is called during Nomad client startup, while discovering and loading plugins.

func (*SkeletonDevicePlugin) Reserve

func (d *SkeletonDevicePlugin) Reserve(deviceIDs []string) (*device.ContainerReservation, error)

Reserve returns information to the task driver on on how to mount the given devices. It may also perform any device-specific orchestration necessary to prepare the device for use. This is called in a pre-start hook on the client, before starting the workload.

func (*SkeletonDevicePlugin) SetConfig

func (d *SkeletonDevicePlugin) SetConfig(c *base.Config) error

SetConfig is called by the client to pass the configuration for the plugin.

func (*SkeletonDevicePlugin) Stats

func (d *SkeletonDevicePlugin) Stats(ctx context.Context, interval time.Duration) (<-chan *device.StatsResponse, error)

Stats streams statistics for the detected devices. Messages should be emitted to the returned channel on the specified interval.

Jump to

Keyboard shortcuts

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