Skip to content

Commit

Permalink
Remove uPayload (#145)
Browse files Browse the repository at this point in the history
* Remove uPayload

The following change removes the unused UPayload protobuf object and places the format in UAttributes.

#144

* Missed the data_content_type from UAttributes!!

* Update basics/uattributes.adoc

Co-authored-by: Pete LeVasseur <peter.levasseur@gm.com>

* switch back to UPayloadFormat to avoid unnecessary changes and since we refer to payload everywhere in the specs

* Incorporated feedback from reviewers

* Add back link in README.adoc to upayloadformat.adoc

* add missing cloudevent mapping

---------

Co-authored-by: Pete LeVasseur <peter.levasseur@gm.com>
  • Loading branch information
Steven Hartley and PLeVasseur authored May 16, 2024
1 parent aaefd48 commit 18fadea
Show file tree
Hide file tree
Showing 8 changed files with 55 additions and 78 deletions.
2 changes: 1 addition & 1 deletion basics/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ The following are the foundational requirements for uProtocol specifications:
* *link:qos.adoc[Quality of Service & Priority (UPriority)]*
* *link:uattributes.adoc[uProtocol Attributes (UAttributes)]*
* *link:umessage.adoc[uProtocol Message (UMessage)]*
* *link:upayload.adoc[uProtocol Payload (UPayload)]*
* *link:upayloadformat.adoc[uProtocol Payload Format (UPayloadFormat)]*
* *link:delivery.adoc[Event Delivery]*
* *link:permissions.adoc[Permissions]*
5 changes: 5 additions & 0 deletions basics/uattributes.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ stem:[t_{current} > t_{id} + ttl]
|no
|A tracing identifier to use for correlating messages across the system. Intended to be compatible with https://github.com/cloudevents/spec/blob/main/cloudevents/extensions/distributed-tracing.md[CloudEvents distributed tracing extension].

|`payload format`
|link:upayloadformat.adoc[UPayloadFormat]
|no
|The format of the payload (data).

|===

[#publish-attributes]
Expand Down
2 changes: 1 addition & 1 deletion basics/umessage.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ SPDX-License-Identifier: Apache-2.0

== Overview

UMessage is the top-level message type for the uProtocol. It consists of link:uattributes.adoc[message metadata] and (optional) link:upayload.adoc[payload]. UMessage is the common way to represent messages sent between uEntities over any communication protocol/middleware.
UMessage is the top-level message type for the uProtocol. It consists of link:uattributes.adoc[message metadata] and (optional) data (payload).

NOTE: Please refer to link:../up-core-api/uprotocol/umessage.proto[umessage.proto] for more details.
13 changes: 5 additions & 8 deletions basics/upayload.adoc → basics/upayloadformat.adoc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
= uProtocol Payload (uPayload)
= uProtocol Payload Format
:toc:
:sectnums:

Expand All @@ -18,13 +18,7 @@ SPDX-FileType: DOCUMENTATION
SPDX-License-Identifier: Apache-2.0
----

== Overview

UPayload is a wrapper around a message's payload data, either by value or reference, as well as some metadata describing the payload like format, size, etc.

NOTE: Please refer to link:../up-core-api/uprotocol/upayload.proto[upayload.proto] for more details

== Payload Format
== Overview

The following table provides an overview of the payload formats supported by uProtocol.

Expand Down Expand Up @@ -60,4 +54,7 @@ The following table provides an overview of the payload formats supported by uPr
|`text/plain`
|The message payload *MUST* be the network byte order UTF-8 encoding of a unicode string representing the payload data.

|`UPAYLOAD_FORMAT_SHM`
|`application/x-shm`
|The message payload *MUST* be the network byte order address of a shared memory segment.
|===
34 changes: 34 additions & 0 deletions up-core-api/uprotocol/uattributes.proto
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ message UAttributes {
// A tracing identifier to use for correlating messages across the system.
// Intended to be compatible with https://github.com/cloudevents/spec/blob/main/cloudevents/extensions/distributed-tracing.md
optional string traceparent = 11;

// The format for the data stored in the UMessage.
UPayloadFormat payload_format = 12;
}


Expand Down Expand Up @@ -118,3 +121,34 @@ enum UPriority {
// Network control such as Safety Critical
UPRIORITY_CS6 = 7 [(uprotocol.ce_name) = "CS6"];
}

// The format for the data stored in the UMessage.
enum UPayloadFormat {
// Payload format was not is not set,
// per specification, assumption is UPAYLOAD_FORMAT_PROTOBUF_WRAPPED_IN_ANY
UPAYLOAD_FORMAT_UNSPECIFIED = 0;

// Payload is an Any protobuf message that contains the packed payload
UPAYLOAD_FORMAT_PROTOBUF_WRAPPED_IN_ANY = 1 [ (uprotocol.mime_type) = "application/x-protobuf" ];

// Protobuf serialization format
UPAYLOAD_FORMAT_PROTOBUF = 2 [ (uprotocol.mime_type) = "application/protobuf" ];

// JSON serialization format
UPAYLOAD_FORMAT_JSON = 3 [ (uprotocol.mime_type) = "application/json" ];

// Basic SOME/IP serialization format
UPAYLOAD_FORMAT_SOMEIP = 4 [ (uprotocol.mime_type) = "application/x-someip" ];

// SOME/IP TLV format
UPAYLOAD_FORMAT_SOMEIP_TLV = 5 [ (uprotocol.mime_type) = "application/x-someip_tlv" ];

// RAW (binary) format
UPAYLOAD_FORMAT_RAW = 6 [ (uprotocol.mime_type) = "application/octet-stream" ];

// Text format
UPAYLOAD_FORMAT_TEXT = 7 [ (uprotocol.mime_type) = "text/plain" ];

// Shared memory format
UPAYLOAD_FORMAT_SHM = 8 [ (uprotocol.mime_type) = "application/x-shm" ];
}
9 changes: 4 additions & 5 deletions up-core-api/uprotocol/umessage.proto
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,18 @@ syntax = "proto3";
package uprotocol.v1;

import "uattributes.proto";
import "upayload.proto";

option java_package = "org.eclipse.uprotocol.v1";
option java_outer_classname = "UMessageProto";
option java_multiple_files = true;

// UMessage is the top-level message type for the uProtocol.
// It contains a header (UAttributes), and payload (UPayload) and is a way of representing a
// It contains a header (UAttributes), and payload and is a way of representing a
// message that would be sent between two uEs.
message UMessage {
// uProtocol mandatory and optional attributes
UAttributes attributes = 1;

// Optional message payload containing the data to be sent
UPayload payload = 2;
}
// Optional message payload
optional bytes payload = 2;
}
63 changes: 0 additions & 63 deletions up-core-api/uprotocol/upayload.proto

This file was deleted.

5 changes: 5 additions & 0 deletions up-l1/cloudevents.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,11 @@ a|A code indicating an error that has occurred during the delivery of either an
|String
|A tracing identifier to use for correlating messages across the system.

|`payload_format`
|`pformat`
|Integer
|The value of the UPayloadFormat that is used to indicate the encoding of the payload

|===

[#ce-formats]
Expand Down

0 comments on commit 18fadea

Please sign in to comment.