config

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetMetadataServerIP

func GetMetadataServerIP(ConfigPath string) (string, int, error)

GetMetadataServerIP is used to obtain the IP and port number of Metadata

func GetServerIP

func GetServerIP(ConfigPath string) (string, int, error)

GetServerIP is used to obtain server IP from the configuration.toml file

func SetClients

func SetClients(host string, protocol string, timeout int)

SetClients configures the service information in terms of Data and Metadata.

func SetDevice

func SetDevice(dataTransform bool, initCmd string, initCmdArgs string, maxCmdOps int,
	maxCmdValueLen int, removeCmd string, removeCmdArgs string, profilesDir string)

SetDevice configures the Device's common information.

func SetDeviceList

func SetDeviceList(name string, profile string, description string, label []string)

SetDeviceList configures the specific Device information

func SetRegistry

func SetRegistry(host string, port int)

SetRegistry configures the Registry information.

func SetService

func SetService(host string, port int, label []string)

SetService configures the Service information.

func SetWritable

func SetWritable(level string)

SetWritable configures the Writable information.

func SetYaml

func SetYaml(name, manufac, model, desc string, labels []string, resources []DeviceResource)

SetYaml configures the device resource information.

func TomlMarshal

func TomlMarshal() (b []byte, err error)

TomlMarshal returns bytes for DataStorage configuration.

func YamlMarshal

func YamlMarshal() (b []byte, err error)

YamlMarshal returns bytes for DataStorage device resource configuration.

Types

type Client

type Client struct {
	Host     string `toml:"Host"`
	Port     int    `toml:"Port"`
	Protocol string `toml:"Protocol"`
	Timeout  int    `toml:"Timeout,omitempty"`
}

Client contains other service information for DataStroage.

type Clients

type Clients map[string]Client

Clients is a map of Clients.

type Device

type Device struct {
	DataTransform  bool   `toml:"DataTransform,omitempty"`
	InitCmd        string `toml:"InitCmd"`
	InitCmdArgs    string `toml:"InitCmdArgs"`
	MaxCmdOps      int    `toml:"MaxCmdOps,omitempty"`
	MaxCmdValueLen int    `toml:"MaxCmdValueLen,omitempty"`
	RemoveCmd      string `toml:"RemoveCmd"`
	RemoveCmdArgs  string `toml:"RemoveCmdArgs"`
	ProfilesDir    string `toml:"ProfilesDir,omitempty"`
}

Device contains the configuration for the DataStorage device.

type DeviceList

type DeviceList []DeviceProperties

DeviceList is a list of the DevicesPropertieses.

type DeviceProperties

type DeviceProperties struct {
	Name        string                        `toml:"Name"`
	Profile     string                        `toml:"Profile"`
	Description string                        `toml:"Description,omitempty"`
	Labels      []string                      `toml:"Labels,omitempty"`
	Protocols   map[string]ProtocolProperties `toml:"Protocols,omitempty"`
}

DeviceProperties contains the configuration for a specific device.

type DeviceResource

type DeviceResource struct {
	Name        string   `yaml:"name"`
	Description string   `yaml:"description,omitempty"`
	Properties  Property `yaml:"properties"`
}

DeviceResource contains the resource information.

type Property

type Property struct {
	Value PropertyDetail `yaml:"value,flow"`
	Units PropertyDetail `yaml:"units,flow"`
}

Property has the value and units properties.

type PropertyDetail

type PropertyDetail struct {
	Type      string `yaml:"type"`
	ReadWrite string `yaml:"readWrite"`
	MediaType string `yaml:"mediaType,omitempty"`
}

PropertyDetail contains the specific property(Value and Units) information. Type : bool, int8 - int64, uint8 - uint64, float32, float64, string, binary types are supported. ReadWrite : R, RW, or W

type ProtocolProperties

type ProtocolProperties map[string]string

ProtocolProperties is a map of device protocols.

type Registry

type Registry struct {
	Host          string `toml:"Host"`
	Port          int    `toml:"Port"`
	Type          string `toml:"Type"`
	CheckInterval string `toml:"CheckInterval,omitempty"`
	FailLimit     int    `toml:"FailLimit,omitempty"`
	FailWaitTime  int    `toml:"FailWaitTime,omitempty"`
}

Registry contains the configuration for the DataStorage in terms of the Registry server.

type Service

type Service struct {
	Host                string   `toml:"Host"`
	Port                int      `toml:"Port"`
	ConnectionRetries   int      `toml:"ConnectionRetries,omitempty"`
	Labels              []string `toml:"Labels"`
	OpenMsg             string   `toml:"OpenMsg,omitempty"`
	Timeout             int      `toml:"Timeout,omitempty"`
	EnableAsyncReadings bool     `toml:"EnableAsyncReadings,omitempty"`
	AsyncBufferSize     int      `toml:"AsyncBufferSize,omitempty"`
}

Service contains the configuration for the DataStorage service.

type Toml

type Toml struct {
	Writable   Writable
	Service    Service
	Registry   Registry
	Device     Device
	DeviceList DeviceList
	Clients    Clients
}

Toml contains the struct for building the DataStorage configuration file.

type Writable

type Writable struct {
	LogLevel string `toml:"LogLevel,omitempty"`
}

Writable contains the configuration for the DataStorage log.

type Yaml

type Yaml struct {
	Name            string           `yaml:"name"`
	Manufacturer    string           `yaml:"manufacturer"`
	Model           string           `yaml:"model"`
	Labels          []string         `yaml:"labels,omitempty"`
	Description     string           `yaml:"description,omitempty"`
	DeviceResources []DeviceResource `yaml:"deviceResources,omitempty"`
}

Yaml contains the struct for building the DataStorage Device Resources configuration.

Jump to

Keyboard shortcuts

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