handlers

package
v0.0.0-...-8171c4f Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2020 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HandlerConfig

type HandlerConfig struct {
	StreamCtx     *containers.StreamCtx
	GlobalCtx     map[string]string
	DeviceManager manager.DeviceManager
}

HandlerConfig contains the data needed to initialize a new GroupHandler implementation.

type InterfaceGroupHandler

type InterfaceGroupHandler struct {
	PrefixParts []string
	Name        string
	StreamCtx   *containers.StreamCtx
	GlobalCtx   map[string]string
	DM          manager.DeviceManager
	// contains filtered or unexported fields
}

InterfaceGroupHandler implements the GroupHandler interface.

It is used for handling OpenConfig telemetry under a prefix with the root node "interfaces".

func NewInterfaceGroupHandler

func NewInterfaceGroupHandler(c *HandlerConfig, parts []string) (*InterfaceGroupHandler, error)

NewInterfaceGroupHandler creates a new instance of an InterfaceGroupHandler.

func (*InterfaceGroupHandler) AddReading

func (ig *InterfaceGroupHandler) AddReading(key string, value interface{}) error

AddReading adds a new reading to the InterfaceGroupHandler's readings collection.

The Synse reading is generated based on the provided key, using the provided value. The InterfaceGroupHandler defines a mapping of keys to Synse readings.

func (*InterfaceGroupHandler) GetDevice

func (ig *InterfaceGroupHandler) GetDevice() (*sdk.Device, error)

GetDevice gets the Device which the InterfaceGroupHandler instance references by name. If the device does not exist, it will be created.

func (*InterfaceGroupHandler) GetReadings

func (ig *InterfaceGroupHandler) GetReadings() []*output.Reading

GetReadings gets the current readings collection for the InterfaceGroupHandler.

func (*InterfaceGroupHandler) MakeDevice

func (ig *InterfaceGroupHandler) MakeDevice() (*sdk.Device, error)

MakeDevice creates a new Device instance based on the details provided by the InterfaceGroupHandler and registers it with the plugin.

type ReadingTemplate

type ReadingTemplate struct {
	OutputName string
	Context    map[string]string
}

ReadingTemplate is an intermediary data container which is used as a convenient way to collect data for mapping an OpenConfig telemetry key to a Synse reading.

Jump to

Keyboard shortcuts

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