Skip to content

Commit e0aaf27

Browse files
authored
Merge pull request #552 from wes-johnson/429
[#429] Consolidated 'oneof value' constructs into a single TypedValue to be reused in the proto file
2 parents 214efde + 9373e6d commit e0aaf27

File tree

1 file changed

+36
-72
lines changed

1 file changed

+36
-72
lines changed

specification/src/main/asciidoc/chapters/Sparkplug_6_Payloads.adoc

Lines changed: 36 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -182,29 +182,40 @@ enum DataType {
182182
183183
message Payload {
184184
185+
message TypedValue {
186+
optional DataType datatype = 1;
187+
optional bool is_null = 2;
188+
189+
oneof value {
190+
int32 int32_value = 3;
191+
int64 int64_value = 4;
192+
uint32 uint32_value = 5;
193+
uint64 uint64_value = 6;
194+
float float_value = 7;
195+
double double_value = 8;
196+
bool boolean_value = 9;
197+
string string_value = 10;
198+
bytes bytes_value = 11;
199+
DataSet dataset_value = 12;
200+
Template template_value = 13;
201+
PropertySet propertyset_value = 14;
202+
PropertySetList propertysets_value = 15;
203+
TypedValueExtension extension_value = 16;
204+
}
205+
206+
message TypedValueExtension {
207+
extensions 1 to max;
208+
}
209+
210+
extensions 17 to max;
211+
}
212+
185213
message Template {
186214
187215
message Parameter {
188-
optional string name = 1;
189-
optional uint32 type = 2;
190-
191-
oneof value {
192-
int32 int32_value = 3;
193-
int64 int64_value = 4;
194-
uint32 uint32_value = 5;
195-
uint64 uint64_value = 6;
196-
float float_value = 7;
197-
double double_value = 8;
198-
bool boolean_value = 9;
199-
string string_value = 10;
200-
bytes bytes_value = 11;
201-
202-
ParameterValueExtension extension_value = 12;
203-
}
204-
205-
message ParameterValueExtension {
206-
extensions 1 to max;
207-
}
216+
optional string name = 1;
217+
optional TypedValue typed_value = 2;
218+
extensions 3 to max;
208219
}
209220
210221
optional string version = 1; // The version of the Template to prevent mismatches
@@ -218,8 +229,8 @@ message Payload {
218229
message DataSet {
219230
220231
message Column {
221-
optional string name = 1;
222-
optional uint32 type = 2;
232+
optional string name = 1;
233+
optional DataType datatype = 2;
223234
224235
// Only one type of repeated value shall be used per Column
225236
repeated uint32 int_values = 3 [packed=true];
@@ -236,37 +247,9 @@ message Payload {
236247
extensions 2 to max;
237248
}
238249
239-
message PropertyValue {
240-
241-
optional uint32 type = 1;
242-
optional bool is_null = 2;
243-
244-
oneof value {
245-
int32 int32_value = 3;
246-
int64 int64_value = 4;
247-
uint32 uint32_value = 5;
248-
uint64 uint64_value = 6;
249-
float float_value = 7;
250-
double double_value = 8;
251-
bool boolean_value = 9;
252-
string string_value = 10;
253-
bytes bytes_value = 11; // Bytes, File
254-
DataSet dataset_value = 12;
255-
PropertySet propertyset_value = 13;
256-
PropertySetList propertysets_value = 14; // List of Property Values
257-
PropertyValueExtension extension_value = 15;
258-
}
259-
260-
message PropertyValueExtension {
261-
extensions 1 to max;
262-
}
263-
264-
extensions 16 to max;
265-
}
266-
267250
message PropertySet {
268251
repeated string keys = 1; // Names of the properties
269-
repeated PropertyValue values = 2;
252+
repeated TypedValue values = 2; // The Property Values
270253
extensions 3 to max;
271254
}
272255
@@ -309,27 +292,8 @@ message Payload {
309292
optional bool is_null = 8; // If this is null - explicitly say so rather than using -1, false, etc for some datatypes.
310293
optional MetaData metadata = 9; // Metadata for the Metric
311294
optional PropertySet properties = 10; // Properties of the Metric
312-
313-
oneof value {
314-
int32 int32_value = 11;
315-
int64 int64_value = 12;
316-
uint32 uint32_value = 13;
317-
uint64 uint64_value = 14;
318-
float float_value = 15;
319-
double double_value = 16;
320-
bool boolean_value = 17;
321-
string string_value = 18;
322-
bytes bytes_value = 19; // Bytes, File
323-
DataSet dataset_value = 20;
324-
Template template_value = 21;
325-
MetricValueExtension extension_value = 22;
326-
}
327-
328-
message MetricValueExtension {
329-
extensions 1 to max;
330-
}
331-
332-
extensions 23 to max;
295+
optional TypedValue value = 11;
296+
extensions 12 to max;
333297
}
334298
335299
optional uint64 timestamp = 1; // Timestamp at message sending time

0 commit comments

Comments
 (0)