plugin

package
v0.0.0-...-16e15a1 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2023 License: MPL-2.0 Imports: 13 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	DefaultTimeout  = time.Second * 10
	DefaultInterval = time.Second * 60
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Address           string `codec:"address"`
	FingerprintPeriod string `codec:"fingerprint_period"`
}

type Plugin

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

func NewPlugin

func NewPlugin(log log.Logger) *Plugin

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 (*Plugin) ConfigSchema

func (d *Plugin) 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 (*Plugin) Fingerprint

func (d *Plugin) 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 (*Plugin) PluginInfo

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

PluginInfo returns information describing the plugin.

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

func (*Plugin) Reserve

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

func (*Plugin) SetConfig

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

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

func (*Plugin) Stats

func (d *Plugin) 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