-
Notifications
You must be signed in to change notification settings - Fork 3
/
synse.proto
386 lines (290 loc) · 10.9 KB
/
synse.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
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
syntax = "proto3";
package synse;
// V3Plugin is the API for plugin communication in Synse v3.
service V3Plugin {
// Devices gets all devices that a plugin manages.
rpc Devices(V3DeviceSelector) returns (stream V3Device) {}
// Health gets the health status of a plugin.
rpc Health(Empty) returns (V3Health) {}
// Metadata gets the plugin meta-information.
rpc Metadata(Empty) returns (V3Metadata) {}
// Read gets readings from the specified plugin device(s).
rpc Read(V3ReadRequest) returns (stream V3Reading) {}
// ReadCache gets the cached readings from the plugin. If the plugin
// is not configured to cache readings, it will returned the entire
// current read state.
rpc ReadCache(V3Bounds) returns (stream V3Reading) {}
// ReadStream returns reading data for the specified devices as they
// are read by the plugin.
rpc ReadStream(V3StreamRequest) returns (stream V3Reading) {}
// Test checks whether the plugin is reachable and ready.
rpc Test(Empty) returns (V3TestStatus) {}
// Transaction gets the status of a write transaction for an
// asynchronous write.
rpc Transaction(V3TransactionSelector) returns (V3TransactionStatus) {}
// Transactions gets all transactions which are currently kept
// in the plugin's transaction cache.
rpc Transactions(Empty) returns (stream V3TransactionStatus) {}
// Version gets the version information for the plugin.
rpc Version(Empty) returns (V3Version) {}
// WriteAsync writes data to the specified plugin device. A transaction ID
// is returned so the write status can be checked asynchronously.
rpc WriteAsync(V3WritePayload) returns (stream V3WriteTransaction) {}
// WriteSync writes data to the specified plugin device. The request blocks
// until the write resolves so no asynchronous checking is required.
rpc WriteSync(V3WritePayload) returns (stream V3TransactionStatus) {}
}
// HealthStatus is the status of a health check.
enum HealthStatus {
UNKNOWN = 0;
OK = 1;
FAILING = 2;
}
// WriteStatus are the statuses of a write as it is processed asynchronously.
enum WriteStatus {
PENDING = 0;
WRITING = 1;
DONE = 3;
ERROR = 4;
}
// Empty is an empty message (no fields) which is used for RPC routes which
// do not require any input for the request.
message Empty {}
// V3Bounds specifies time bounds in RFC3339 format.
message V3Bounds {
// RFC3339 formatted timestamp specifying the beginning of the time bound. If
// left unspecified, the start is considered unbound.
string start = 1;
// RFC3339 formatted timestamp specifying the ending of the time bound. If
// left unspecified, the end is considered unbound.
string end = 2;
}
// V3Device contains all of the pertinent known data associated with a device.
message V3Device {
// RFC3339 timestamp for when the device info was gathered.
string timestamp = 1;
// The globally unique ID for the device.
string id = 2;
// The type of device.
string type = 3;
// The id of the plugin that the device is managed by.
string plugin = 4;
// Additional information for the device.
string info = 5;
// A human-readable alias for the device.
string alias = 6;
// Any arbitrary metadata associated with the device.
map<string,string> metadata = 7;
// The read/write capabilities of the device.
V3DeviceCapability capabilities = 8;
// The tags that are associated with the device.
repeated V3Tag tags = 9;
// The reading outputs that the device can generate on read.
repeated V3DeviceOutput outputs = 10;
// A 1-based sort ordinal for the device. This will help determine where
// the device shows up in the scan.
int32 sortIndex = 11;
}
// V3DeviceCapability specifies the capabilities that a device exposes via Synse.
message V3DeviceCapability {
// The capability mode of the device ("r": read only, "w": write only, "rw": read/write)
string mode = 1;
// The write capabilities of the device.
V3WriteCapability write = 2;
}
// V3DeviceOutput specifies the output types for a device's reading(s).
message V3DeviceOutput {
// The name of the device output.
string name = 1;
// The type of the output.
string type = 2;
// The decimal precision of the output. A precision of 0 (default) means no
// precision is applied.
int32 precision = 3;
// The factor to multiply the reading result returned from the device. This can be
// positive, negative, whole, or decimal.
double scalingFactor = 4;
// The unit of measure for the reading output.
V3OutputUnit unit = 5;
}
// V3DeviceSelector specifies a selector to identify devices for various actions.
message V3DeviceSelector {
// The tags to use as selectors.
repeated V3Tag tags = 1;
// The ID of the device. If this is set, tags will be ignored.
string id = 2;
}
// V3Health is the health status for a plugin.
message V3Health {
// RFC3339 formatted timestamp of the time when the health was checked.
string timestamp = 1;
// The overall health status of a plugin.
HealthStatus status = 2;
// All of the health checks for a plugin.
repeated V3HealthCheck checks = 3;
}
// V3HealthCheck is the health check status for a plugin.
message V3HealthCheck {
// The name of the health check.
string name = 1;
// The status of the health check.
HealthStatus status = 2;
// Any additional information associated with the health check.
string message = 3;
// RFC3339 formatted timestamp at which the check was last completed.
string timestamp = 4;
// The type of health check. The different kinds of health check are
// defined in the SDK.
string type = 5;
}
// V3Metadata is static metadata about a plugin.
message V3Metadata {
// The name of the plugin.
string name = 1;
// The maintainer of the plugin.
string maintainer = 2;
// The normalized tag name for plugin meta-info.
string tag = 3;
// A brief description of the plugin.
string description = 4;
// A link to the plugin's VCS repo.
string vcs = 5;
// The generated plugin namespace ID.
string id = 6;
}
// V3OutputUnit the unit of measure for a reading.
message V3OutputUnit {
// The full name of the unit.
string name = 1;
// The symbolic representation of the unit.
string symbol = 2;
}
// V3Reading is a reading response from a device.
message V3Reading {
// The GUID of the device being read from.
string id = 1;
// RFC3339 formatted timestamp for when the reading was taken.
string timestamp = 2;
// The type of the reading.
string type = 3;
// The type of the device the reading originated from.
string deviceType = 4;
// Any additional information associated with a reading.
map<string,string> context = 5;
// The unit of measure for the reading.
V3OutputUnit unit = 6;
// The value of the reading.
oneof value {
string string_value = 7;
bool bool_value = 8;
float float32_value = 9;
double float64_value = 10;
int32 int32_value = 11;
int64 int64_value = 12;
bytes bytes_value = 13;
uint32 uint32_value = 14;
uint64 uint64_value = 15;
}
// Info string associated with the Reading's device. This provides
// additional human-readable context for the reading.
string deviceInfo = 16;
}
// V3ReadRequest is a request for device readings.
message V3ReadRequest {
// The selector for the device(s) to read from.
V3DeviceSelector selector = 1;
}
// V3StreamRequest is a request to stream device readings. It allows the
// requester to specify multiple device selectors to allow for additive
// device selection.
message V3StreamRequest {
repeated V3DeviceSelector selectors = 1;
}
// V3Tag is a specification for a single tag.
message V3Tag {
// The namespace of the tag.
string namespace = 1;
// The annotation of the tag.
string annotation = 2;
// The tag label.
string label = 3;
}
// V3TestStatus is the status response for plugin availability.
message V3TestStatus {
// A flag describing whether the plugin is ready and reachable.
bool ok = 1;
}
// V3TransactionSelector specifies a selector to identify a transaction.
message V3TransactionSelector {
// The ID of a write transaction.
string id = 1;
}
// V3TransactionStatus the status of a write transaction.
message V3TransactionStatus {
// The ID of the write transaction.
string id = 1;
// RFC3339 formatted timestamp of when the transaction was created.
string created = 2;
// RFC3339 formatted timestamp of when the transaction was last updated.
string updated = 3;
// Context information for any errors that may have occurred.
string message = 4;
// The timeout within which the transaction remains valid.
string timeout = 5;
// The status of the write (pending, writing, done, error).
WriteStatus status = 6;
// The data that was written for the write transaction.
V3WriteData context = 7;
}
// V3Version provides version information for the plugin.
message V3Version {
// The semantic version of the plugin.
string pluginVersion = 1;
// The version of the SDK the plugin uses.
string sdkVersion = 2;
// The timestamp from when the plugin was built.
string buildDate = 3;
// The commit hash at which the plugin was built.
string gitCommit = 4;
// The tag name at which the plugin was built.
string gitTag = 5;
// The architecture that the plugin was built.
string arch = 6;
// The operating system that the plugin was built for.
string os = 7;
}
// V3WriteCapability specifies the write capabilities for a device.
message V3WriteCapability {
// The write actions supported by a device.
repeated string actions = 1;
}
// V3WriteData is the data to write to a device.
message V3WriteData {
// The action string for the write.
string action = 1;
// Additional data for the write action.
bytes data = 2;
// A custom transaction that can be associated with the write.
string transaction = 3;
}
// V3WritePayload the payload for a write which specifies the device to
// write to and the data to write.
message V3WritePayload {
// The selector for the device to write to. This should resolve
// to a single device.
V3DeviceSelector selector = 1;
// The data to write to the device.
repeated V3WriteData data = 2;
}
// V3WriteTransaction contains information associating a write action with
// a transaction for asynchronous tracking.
message V3WriteTransaction {
// The ID of the write transaction.
string id = 1;
// The GUID of the device written to.
string device = 2;
// The data that was written for the write transaction.
V3WriteData context = 3;
// The timeout within which the transaction remains valid.
string timeout = 4;
}