Documentation ¶
Index ¶
- Variables
- func AddToErrors(socketKey string, errorMessage string)
- func CheckConnectionsMapExists(socketKey string) bool
- func CheckForEndPointInCache(socketKey string, endPoint string) bool
- func CloseSocketConnection(socketKey string)
- func DoPost(socketKey string, theURL string, jsonReq string) (string, error)
- func GetDeviceStateEndpoint(socketKey string, endpoint string) string
- func Log(text string)
- func ReadLineFromSocket(socketKey string) string
- func RegisterMainGetFunc(fn MainGetFunc)
- func RegisterMainSetFunc(fn MainSetFunc)
- func SetDeviceStateEndpoint(socketKey string, endpoint string, value string)
- func Startup()
- func WriteLineToSocket(socketKey string, line string) bool
- type MainGetFunc
- type MainSetFunc
Constants ¶
This section is empty.
Variables ¶
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
var ConnectTimeout = 5 // seconds
var DefaultSocketPort int
var FunctionStackFull = 100
var GlobalDelimiter = 13 // Read end of line delimiter (defaults to carriage return if the microservice doesn't set it)
var KeepAlive = false
var KeepRefreshingFor = 300 // seconds (should be 300 after debugging)
var MaxReadTries = 6
var MicroserviceName = ""
var ReadFailSleep = 500 // milliseconds
var ReadNoSleepTries = 5
var ReadTimeout = 5 // seconds
var RefreshDataPointsEvery = 50 // seconds (should be 50 after debugging so it's a little faster than the orchestrator gets)
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.
var ReportOlderInterval = 120 // seconds (used to throttle function stack errors when network connectivity is gone)
var TryReadTimeout = 150 // milliseconds
var UseTelnet = false
var UseUDP = false
tunables Use setFrameworkGlobals() in microservice.go to change these variables.
var WriteTimeout = 5 // seconds
Functions ¶
func AddToErrors ¶
Prints the error and adds it the deviceErrors map
func CheckConnectionsMapExists ¶
External function to check if a connection exists. Handles locking and unlocking the mutex.
func CheckForEndPointInCache ¶
func CloseSocketConnection ¶
func CloseSocketConnection(socketKey string)
func DoPost ¶
Used for the Bravia microservice This function started from a tutorial: https://www.soberkoder.com/consume-rest-api-go/
func GetDeviceStateEndpoint ¶
Can be called externally to get the cached value for a device endpoint
func ReadLineFromSocket ¶
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 ¶
Can be called externally to set the cached value for a device endpoint
func WriteLineToSocket ¶
Types ¶
type MainGetFunc ¶
Define a type for the callback function