config

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2020 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BoundConfig

type BoundConfig struct {
	Thermometers  []BoundThermometer
	Database      database.CalorDB
	Port          int
	ReadAcceptors []BoundReadAcceptor
}

A BoundConfig represents a confuration that has actual calor structs loaded into memory

type BoundReadAcceptor

type BoundReadAcceptor struct {
	Name         string
	ReadAcceptor readings.ReadAcceptor
}

type BoundThermometer

type BoundThermometer struct {
	Name           string
	Thermometer    thermometers.Thermometer
	UpdateInterval int
}

type ConfigBinder

type ConfigBinder interface {
	Bind(config LoadedConfig) BoundConfig
}

A ConfigBinder is a type that can take some LoadedConfig and produce a Bound Config From it. Currently it's a fairly useless abstraction, but eventually we'll want to be able bind configs from other sources, and hence we don't want to directly work with LoadedConfigs

type ConfigLoader

type ConfigLoader interface {
	Load(filepath string) LoadedConfig
}

A ConfigLoader takes a config file and produces a LoadedConfig Currently we just have the json loader

type DatabaseConfig

type DatabaseConfig struct {
	DriverType string
	File       string
	Host       string
	Port       string
	Username   string
	Password   string
}

A DabaaseConfig contains all config needed to describe a DB connection

type JsonLoader

type JsonLoader struct{}

A config loader that reads from a JSON file

func (JsonLoader) Load

func (loader JsonLoader) Load(filepath string) LoadedConfig

type LoadedConfig

type LoadedConfig struct {
	Thermometers  []ThermometerConfig
	Database      DatabaseConfig
	Port          int            // TCP port to start listening on
	ReadAcceptors []ReadAcceptor // the things readings get output to
}

A LoadedConfig is a struct declaring what we want, but does not actually contain any valid calor types

type LoadedConfigBinder added in v0.0.5

type LoadedConfigBinder struct{}

A LoadedConfig bnder accepts a LoadedConfig and produces a Bound Config from it.

func (LoadedConfigBinder) Bind added in v0.0.5

type ReadAcceptor

type ReadAcceptor struct {
	Name       string
	DriverType string
}

A ReadAcceptor contains all config needed to construct a particular type of read acceptor

type ThermometerConfig

type ThermometerConfig struct {
	Name           string
	DriverType     string
	UpdateInterval int // time in seconds to take a reading
	Options        map[string]string
}

A ThermometerConfig is the basic config for a thermometer The options map exist to allow key/value pairs that are specific to a particular driver type

Jump to

Keyboard shortcuts

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