|
1 | | -"""Contains classes and enums to represent measurement metadata.""" |
| 1 | +"""Measurement service metadata classes and enums.""" |
2 | 2 | from __future__ import annotations |
3 | 3 |
|
4 | 4 | import enum |
|
7 | 7 |
|
8 | 8 |
|
9 | 9 | class MeasurementInfo(NamedTuple): |
10 | | - """Class that represents the measurement information. |
11 | | -
|
12 | | - Attributes |
13 | | - ---------- |
14 | | - display_name (str): The measurement display name for client to display to user. |
15 | | -
|
16 | | - version (str): The measurement version that helps to |
17 | | - maintain versions of a measurement in future. |
18 | | -
|
19 | | - ui_file_paths (list): Absolute paths of the UI file(s) linked to the measurement. |
20 | | -
|
21 | | - """ |
| 10 | + """A named tuple providing information about a measurement.""" |
22 | 11 |
|
23 | 12 | display_name: str |
| 13 | + """The user visible name of the measurement.""" |
| 14 | + |
24 | 15 | version: str |
| 16 | + """The current version of the measurement.""" |
| 17 | + |
25 | 18 | ui_file_paths: List[Path] |
| 19 | + """Absolute paths to user interface files for the measurement (e.g. ``.measui`` or ``.vi`` |
| 20 | + files).""" |
26 | 21 |
|
27 | 22 |
|
28 | 23 | class ServiceInfo(NamedTuple): |
29 | | - """Class that represents the service information. |
30 | | -
|
31 | | - Attributes |
32 | | - ---------- |
33 | | - service_class (str): Service class that the measurement belongs to. |
34 | | - Measurements under same service class expected to perform same logic. |
35 | | - For e.g., different version of measurement can come under same service class. |
36 | | -
|
37 | | -
|
38 | | - description_url (str): Description URL of the measurement. |
39 | | -
|
40 | | - provided_interfaces (List[str]): List of interfaces the service provides. |
41 | | - For e.g., ni.measurementlink.measurement.v2.MeasurementService. |
42 | | - Defaults to ["ni.measurementlink.measurement.v1.MeasurementService"]. |
43 | | -
|
44 | | - annotations (Dict[str,str]): Dict that contains extra information of the measurement. |
45 | | - As default we added a (str) description, (str) collection and a (List[str]) list of tags. |
46 | | - Feel free to add your own Annotations as needed. |
| 24 | + """A named tuple providing information about a registered service. |
47 | 25 |
|
| 26 | + This class is used with the MeasurementLink discovery service when registering and enumerating |
| 27 | + services. |
48 | 28 | """ |
49 | 29 |
|
50 | 30 | service_class: str |
| 31 | + """"The "class" of a service. The value of this field should be unique for a given interface |
| 32 | + in ``provided_interfaces``. In effect, the ``.proto`` service declaration defines the |
| 33 | + interface, and this field defines a class or concrete type of the interface.""" |
| 34 | + |
51 | 35 | description_url: str |
| 36 | + """The URL of a web page that provides a description of the service.""" |
| 37 | + |
52 | 38 | provided_interfaces: List[str] = ["ni.measurementlink.measurement.v1.MeasurementService"] |
| 39 | + """The service interfaces provided by the service. These are gRPC full names for the service.""" |
| 40 | + |
53 | 41 | annotations: Dict[str, str] = {} |
| 42 | + """Represents a set of annotations on the service. |
| 43 | + |
| 44 | + Well-known annotations: |
| 45 | +
|
| 46 | + - Description |
| 47 | + - Key: "ni/service.description" |
| 48 | + - Expected format: string |
| 49 | + - Example: "Measure inrush current with a shorted load and validate results against |
| 50 | + configured limits." |
| 51 | + - Collection |
| 52 | + - Key: "ni/service.collection" |
| 53 | + - Expected format: "." delimited namespace/hierarchy case-insensitive string |
| 54 | + - Example: "CurrentTests.Inrush" |
| 55 | + - Tags |
| 56 | + - Key: "ni/service.tags" |
| 57 | + - Expected format: serialized JSON string of an array of strings |
| 58 | + - Example: "[\"powerup\", \"current\"]" |
| 59 | + """ |
54 | 60 |
|
55 | 61 |
|
56 | 62 | class TypeSpecialization(enum.Enum): |
|
0 commit comments