-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsdv_databroker_v1.proto
317 lines (274 loc) · 9.57 KB
/
sdv_databroker_v1.proto
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
/********************************************************************************
* Copyright (c) 2022 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Apache License 2.0 which is available at
* http://www.apache.org/licenses/LICENSE-2.0
*
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/
syntax = "proto3";
package sdv.databroker.v1;
import "google/protobuf/timestamp.proto";
// Data type of a signal
//
// Protobuf doesn't support int8, int16, uint8 or uint16.
// These are mapped to sint32 and uint32 respectively.
//
enum DataType {
STRING = 0;
BOOL = 1;
INT8 = 2;
INT16 = 3;
INT32 = 4;
INT64 = 5;
UINT8 = 6;
UINT16 = 7;
UINT32 = 8;
UINT64 = 9;
FLOAT = 10;
DOUBLE = 11;
TIMESTAMP = 12;
STRING_ARRAY = 20;
BOOL_ARRAY = 21;
INT8_ARRAY = 22;
INT16_ARRAY = 23;
INT32_ARRAY = 24;
INT64_ARRAY = 25;
UINT8_ARRAY = 26;
UINT16_ARRAY = 27;
UINT32_ARRAY = 28;
UINT64_ARRAY = 29;
FLOAT_ARRAY = 30;
DOUBLE_ARRAY = 31;
TIMESTAMP_ARRAY = 32;
}
enum DatapointError {
UNKNOWN_DATAPOINT = 0;
INVALID_TYPE = 1;
ACCESS_DENIED = 2;
INTERNAL_ERROR = 3;
OUT_OF_BOUNDS = 4;
}
enum EntryType {
ENTRY_TYPE_UNSPECIFIED = 0;
ENTRY_TYPE_SENSOR = 1;
ENTRY_TYPE_ACTUATOR = 2;
ENTRY_TYPE_ATTRIBUTE = 3;
}
enum ChangeType {
STATIC = 0; // Value never changes
ON_CHANGE = 1; // Updates are provided every time the value changes (i.e.
// window is open / closed)
CONTINUOUS = 2; // Value is updated continuously. Broker needs to tell
// provider the preferred (update) frequency.
}
message StringArray {
repeated string values = 1;
}
message BoolArray {
repeated bool values = 1;
}
message Int32Array {
repeated sint32 values = 1;
}
message Int64Array {
repeated sint64 values = 1;
}
message Uint32Array {
repeated uint32 values = 1;
}
message Uint64Array {
repeated uint64 values = 1;
}
message FloatArray {
repeated float values = 1;
}
message DoubleArray {
repeated double values = 1;
}
message Datapoint {
// Timestamp of the value
google.protobuf.Timestamp timestamp = 1;
// values
oneof value {
Failure failure_value = 10;
string string_value = 11;
bool bool_value = 12;
sint32 int32_value = 13;
sint64 int64_value = 14;
uint32 uint32_value = 15;
uint64 uint64_value = 16;
float float_value = 17;
double double_value = 18;
StringArray string_array = 21;
BoolArray bool_array = 22;
Int32Array int32_array = 23;
Int64Array int64_array = 24;
Uint32Array uint32_array = 25;
Uint64Array uint64_array = 26;
FloatArray float_array = 27;
DoubleArray double_array = 28;
}
enum Failure {
// The data point is known, but doesn't have a valid value
INVALID_VALUE = 0;
// The data point is known, but no value is available
NOT_AVAILABLE = 1;
// Unknown datapoint
UNKNOWN_DATAPOINT = 2;
// Access denied
ACCESS_DENIED = 3;
// Unexpected internal error
INTERNAL_ERROR = 4;
}
}
message Metadata {
// Id to be used in "get" and "subscribe" requests. Ids stay valid during
// one power cycle, only.
int32 id = 1;
EntryType entry_type = 2;
string name = 4;
DataType data_type = 5;
ChangeType change_type = 6; // CONTINUOUS or STATIC or ON_CHANGE
string description = 7;
// int32 min_update_hz = 10; // Only for CONTINUOUS
// int32 max_update_hz = 11; // Only for CONTINUOUS
}
service Broker {
// Request a set of datapoints (values)
//
// Returns a list of requested data points.
//
// InvalidArgument is returned if the request is malformed.
rpc GetDatapoints(GetDatapointsRequest) returns (GetDatapointsReply);
// Set a datapoint (values)
rpc SetDatapoints(SetDatapointsRequest) returns (SetDatapointsReply);
// Subscribe to a set of data points or conditional expressions
// using the Data Broker Query Syntax (described in QUERY.md)
//
// Returns a stream of replies.
//
// InvalidArgument is returned if the request is malformed.
rpc Subscribe(SubscribeRequest) returns (stream SubscribeReply);
// Request the metadata of a set of datapoints
//
// Returns metadata of the requested data points that exist.
rpc GetMetadata(GetMetadataRequest) returns (GetMetadataReply);
}
message GetDatapointsRequest {
// A list of requested data points.
repeated string datapoints = 1;
}
message GetDatapointsReply {
// Contains the values of the requested data points.
// If a requested data point is not available, the corresponding Datapoint
// will have the respective failure value set.
map<string, Datapoint> datapoints = 1;
}
message SetDatapointsRequest {
// A map of data points to set
map<string, Datapoint> datapoints = 1;
}
message SetDatapointsReply {
// A map of errors (if any)
map<string, DatapointError> errors = 1;
}
message SubscribeRequest {
// Subscribe to a set of data points (or expressions) described
// by the provided query.
// The query syntax is a subset of SQL and is described in more
// detail in the QUERY.md file.
string query = 2;
}
message SubscribeReply {
// Contains the fields specified by the query.
// If a requested data point value is not available, the corresponding
// Datapoint will have it's respective failure value set.
map<string, Datapoint> fields = 1;
}
message GetMetadataRequest {
// Request metadata for a list of data points referenced by their names.
// e.g. "Vehicle.Cabin.Seat.Row1.Pos1.Position" or "Vehicle.Speed".
//
// If no names are provided, metadata for all known data points will be
// returned.
repeated string names = 1;
}
message GetMetadataReply {
// Contains metadata of the requested data points. If a data point
// doesn't exist (i.e. not known to the Data Broker) the corresponding
// Metadata isn't part of the returned list.
repeated Metadata list = 1;
}
service Collector {
// Register new datapoint (metadata)
//
// If the registration of at least one of the passed data point fails, the overall registration
// is rejected and the gRPC status code ABORTED is returned (to indicate the "aborted" registration).
// The details, which data point(s) caused the failure and the reason, is passed in back in human-
// readable form in the status message. Possible failure resaons are:
// * PERMISSION_DENIED - Not allowed to register this name
// * ALREADY_REGISTERED - The data point is already registered by some other feeder
// * RE_REGISTRATION_MISMATCH - Already registered by this feeder but with differing metadata
// * INVALID_NAME - The passed name of the datapoint has an invalid structure
// * INVALID_VALUE_TYPE - The passed ValueType is not supported
// * INVALID_CHANGE_TYPE - The passed ChangeType is not supported
rpc RegisterDatapoints(RegisterDatapointsRequest) returns (RegisterDatapointsReply);
// Provide a set of updated datapoint values to the broker.
// This is the unary equivalent of `StreamDatapoints` below and is better suited for cases
// where the frequency of updates is rather low.
//
// NOTE: The values provided in a single request are handled as a single update in the
// data broker. This ensures that any clients requesting (or subscribing to) a set of
// datapoints will get a consistent update, i.e. that either all values are updated or
// none are.
//
// Returns: any errors encountered updating the datapoints
//
rpc UpdateDatapoints(UpdateDatapointsRequest) returns (UpdateDatapointsReply);
// Provide a stream with updated datapoint values to the broker.
// This is the streaming equivalent of `UpdateDatapoints` above and is better suited for
// cases where the frequency of updates is high.
//
// NOTE: The values provided in a single request are handled as a single update in the
// data broker. This ensures that any clients requesting (or subscribing to) a set of
// datapoints will get a consistent update, i.e. that either all values are updated or
// none are.
//
// Returns: any errors encountered updating the datapoints
//
rpc StreamDatapoints(stream StreamDatapointsRequest) returns (stream StreamDatapointsReply);
}
message UpdateDatapointsRequest {
map<int32, Datapoint> datapoints = 1;
}
message UpdateDatapointsReply {
map<int32, DatapointError> errors = 1; // If empty, everything went well
}
message StreamDatapointsRequest {
map<int32, Datapoint> datapoints = 1;
}
message StreamDatapointsReply {
map<int32, DatapointError> errors = 1; // If empty, everything went well
}
message RegisterDatapointsRequest {
repeated RegistrationMetadata list = 1;
}
message RegistrationMetadata {
// Name of the data point
// (e.g. "Vehicle.Cabin.Seat.Row1.Pos1.Position" or "Vehicle.Speed")
string name = 1;
DataType data_type = 2;
string description = 3;
ChangeType change_type = 4;
// int32 min_update_hz = 10; // Only for CONTINUOUS
// int32 max_update_hz = 11; // Only for CONTINUOUS
};
message RegisterDatapointsReply {
// Maps each data point name passed in RegisterDatapointsRequest to a data point id
map<string, int32> results = 1;
}