framework

package
v0.0.0-...-e8c0171 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2024 License: GPL-3.0 Imports: 15 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CheckFunctionAppendBehavior string = "Don't add another instance"

All possible values are "Don't add another instance", "Remove older instance", or "Add another instance" microservices can override this in their own code by setting this global variable

View Source
var ConnectTimeout = 5 // seconds
View Source
var DefaultSocketPort int
View Source
var FunctionStackFull = 100
View Source
var GlobalDelimiter = 13 // Read end of line delimiter (defaults to carriage return if the microservice doesn't set it)
View Source
var KeepAlive = false
View Source
var KeepRefreshingFor = 300 // seconds (should be 300 after debugging)
View Source
var MaxReadTries = 6
View Source
var MicroserviceName = ""
View Source
var ReadFailSleep = 500 // milliseconds
View Source
var ReadNoSleepTries = 5
View Source
var ReadTimeout = 5 // seconds
View Source
var RefreshDataPointsEvery = 50 // seconds (should be 50 after debugging so it's a little faster than the orchestrator gets)
View Source
var RelatedActions = make(map[string]map[string]string)

globals We've found sync.Map that could handle locking/unlocking by itself. Keeping as is for now to avoid potentially introducing bugs.

View Source
var ReportOlderInterval = 120 // seconds (used to throttle function stack errors when network connectivity is gone)
View Source
var TryReadTimeout = 150 // milliseconds
View Source
var UseTelnet = false
View Source
var UseUDP = false

tunables Use setFrameworkGlobals() in microservice.go to change these variables.

View Source
var WriteTimeout = 5 // seconds

Functions

func AddToErrors

func AddToErrors(socketKey string, errorMessage string)

Prints the error and adds it the deviceErrors map

func CheckConnectionsMapExists

func CheckConnectionsMapExists(socketKey string) bool

External function to check if a connection exists. Handles locking and unlocking the mutex.

func CheckForEndPointInCache

func CheckForEndPointInCache(socketKey string, endPoint string) bool

func CloseSocketConnection

func CloseSocketConnection(socketKey string)

func DoPost

func DoPost(socketKey string, theURL string, jsonReq string) (string, error)

Used for the Bravia microservice This function started from a tutorial: https://www.soberkoder.com/consume-rest-api-go/

func GetDeviceStateEndpoint

func GetDeviceStateEndpoint(socketKey string, endpoint string) string

Can be called externally to get the cached value for a device endpoint

func Log

func Log(text string)

func ReadLineFromSocket

func ReadLineFromSocket(socketKey string) string

func RegisterMainGetFunc

func RegisterMainGetFunc(fn MainGetFunc)

Function to register the main package function

func RegisterMainSetFunc

func RegisterMainSetFunc(fn MainSetFunc)

Function to register the main package function

func SetDeviceStateEndpoint

func SetDeviceStateEndpoint(socketKey string, endpoint string, value string)

Can be called externally to set the cached value for a device endpoint

func Startup

func Startup()

func WriteLineToSocket

func WriteLineToSocket(socketKey string, line string) bool

Types

type MainGetFunc

type MainGetFunc func(socketKey string, setting string, arg1 string, arg2 string) (string, error)

Define a type for the callback function

type MainSetFunc

type MainSetFunc func(socketKey string, setting string, arg1 string, arg2 string, arg3 string) (string, error)

Jump to

Keyboard shortcuts

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