nats

package
v0.0.0-...-46c35f9 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2024 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Disconnect

func Disconnect()

Drain and close the internal NATS connection.

func HandlerAggregatedMeasurement

func HandlerAggregatedMeasurement(subject string, reply string, amr *types.AggregatedMeasurementRequest)

Starts an aggregated measurement and sends back brief stats.

func HandlerRawMeasurement

func HandlerRawMeasurement(subject string, reply string, rmr *types.RawMeasurementRequest)

Starts a raw measurement and sends back brief stats.

func HandlerStats

func HandlerStats(subject string, reply string, _ interface{})

Responds with full system stats (system.GetStats).

func HandlerStatsBrief

func HandlerStatsBrief(subject string, reply string, _ interface{})

Responds with brief system stats (system.GetStatsBrief).

func Init

func Init(config *koanf.Koanf, tokenFile string) error

Initializes the internal NATS connection and sets up handlers for various subjects. Uses the token found in tokenFile but also looks for the token in the config, under nats.token (ORFS_NATS_TOKEN in env variables).

Types

type Error

type Error struct {
	SensorID string `json:"sensorId"`
	Error    error  `json:"error"`
}

type Output

type Output struct {
	SensorID string `json:"sensorId"`
	Output   string `json:"output"`
}

type Route

type Route struct {
	Subject string
	Handler interface{}
}

Type Route represents a channel to subscribe to and the relative handler.

Jump to

Keyboard shortcuts

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