controller

package
v0.0.0-...-9604f65 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BasicErrJoin

func BasicErrJoin(prevErr error, newErr error) error

a very basic equivalent of errors.Join, but works for go < 1.2

func NoopSubsystem

func NoopSubsystem() *mockSubsystem

Types

type Controller

type Controller interface {
	Subsystem(string) (Subsystem, error)
	Telemetry() telemetry.Telemetry
	Store() storage.Store
	LogError(string, string) error
	DM() *device_manager.DeviceManager
}

func TestController

func TestController() (Controller, error)

type Entity

type Entity interface {
	EName() string
	Status() (interface{}, error)
}

type HomeoStasisConfig

type HomeoStasisConfig struct {
	Name       string
	IsMacro    bool
	Period     int
	Upper      string
	Downer     string
	Min, Max   float64
	Hysteresis float64
}

type Homeostasis

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

func NewHomeostasis

func NewHomeostasis(c Controller, config HomeoStasisConfig) *Homeostasis

func (*Homeostasis) EmitMetric

func (h *Homeostasis) EmitMetric(m string, v float64)

func (*Homeostasis) Sub

func (h *Homeostasis) Sub() Subsystem

func (*Homeostasis) Sync

func (h *Homeostasis) Sync(o *Observation) error

type Observation

type Observation struct {
	Value  float64            `json:"value"`
	Upper  int                `json:"up"`
	Downer int                `json:"down"`
	Time   telemetry.TeleTime `json:"time"`
	// contains filtered or unexported fields
}

func NewObservation

func NewObservation(v float64) Observation

func (Observation) Before

func (o1 Observation) Before(o2 telemetry.Metric) bool

func (Observation) Rollup

func (o1 Observation) Rollup(o telemetry.Metric) (telemetry.Metric, bool)

type Subsystem

type Subsystem interface {
	Setup() error
	LoadAPI(*mux.Router)
	Start()
	Stop()
	On(string, bool) error
	InUse(string, string) ([]string, error)
	GetEntity(string) (Entity, error)
}

type SubsystemComposite

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

func NewSubsystemComposite

func NewSubsystemComposite() *SubsystemComposite

func (*SubsystemComposite) Load

func (s *SubsystemComposite) Load(name string, sub Subsystem)

func (*SubsystemComposite) LoadAPI

func (s *SubsystemComposite) LoadAPI(router *mux.Router)

func (*SubsystemComposite) Setup

func (s *SubsystemComposite) Setup() error

func (*SubsystemComposite) Sub

func (s *SubsystemComposite) Sub(name string) (Subsystem, error)

func (*SubsystemComposite) Unload

func (s *SubsystemComposite) Unload(name string)

func (*SubsystemComposite) UnloadAll

func (s *SubsystemComposite) UnloadAll()

Jump to

Keyboard shortcuts

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