commons

package
v0.47.0 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: Apache-2.0 Imports: 10 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package commons holds what several packages share about devices, services and aspects.

Index

Constants

View Source
const ModifierSeparator = "$"

ModifierSeparator separates the id of a device or device type from the parameters of a modified id, e.g. a device with a local service group: "<id>$<url encoded parameters>".

Variables

This section is empty.

Functions

func AspectNodesByIds

func AspectNodesByIds(ctx context.Context, client devicerepository.Interface, ids []string) ([]models.AspectNode, error, int)

AspectNodesByIds reads the nodes of ids with one request and returns them in the order of ids. Every id has to resolve: device-repository leaves an unknown id out of the list without an error, which is answered here with 404. Nodes are readable for everyone, so no token.

func CompleteAspectNodes

func CompleteAspectNodes(ctx context.Context, client devicerepository.Interface, nodes []models.AspectNode) ([]models.AspectNode, error, int)

CompleteAspectNodes reads the nodes that carry only their id, e.g. the aspects of a modeled payload, with one request; complete nodes stay as they are.

func ContentsMatch

func ContentsMatch(contents []models.Content, functionId string, aspects []models.AspectNode) bool

ContentsMatch reports whether a content variable serves the function and every requested aspect, by the aspect itself or a descendant; without aspects the function alone decides. This follows the service filter of external-task-worker v0.1.2 lib/devicegroups.

func MissingFunctions added in v0.46.0

func MissingFunctions(contents []models.Content, criteria []FunctionCriteria) (missing []int)

MissingFunctions lists the indices of the criteria that no content serves, each checked with ContentsMatch; empty if the contents serve all of them. A device command with additional functions goes to one service that serves every one of them (SNRGY-5157).

func ServiceIdToTopic

func ServiceIdToTopic(id string) string

ServiceIdToTopic is the Kafka topic of the data of a service.

func SplitModifier

func SplitModifier(id string) (pureId string, modifier map[string][]string)

SplitModifier returns the id without modifier and the modifier parameters; parameters that cannot be read are ignored.

Types

type FunctionCriteria added in v0.46.0

type FunctionCriteria struct {
	FunctionId string
	Aspects    []models.AspectNode
}

FunctionCriteria is one function a service has to serve, with every aspect it has to serve it for.

Jump to

Keyboard shortcuts

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