Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove UPayload #108

Merged

Conversation

AnotherDaniel
Copy link
Contributor

Following up-spec #145, remove UPayload from the rust library. This let's us get rid of RpcMapper entirely, which is nice. For now I did not 'save' the RpcMapper::pack_any() and RpcMapper::unpack_any() methods, because they are not needed anywhere I can see and also have little to do with the actual uProtocol scope. Shout if you're missing them nonetheless!

src/rpc/rpcclient.rs Outdated Show resolved Hide resolved
src/umessage/umessagebuilder.rs Outdated Show resolved Hide resolved
src/umessage.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@evshary evshary left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.
Just one question: Should we pin at a specific commit of up-spec instead of main in build.rs? When the up-spec (up-core-api) changes, it'll break the up-rust and affect other libraries depending on up-rust.
I think it'll be better to fix it at a specific commit and keep updating regularly.

@sophokles73
Copy link
Contributor

Just one question: Should we pin at a specific commit of up-spec instead of main in build.rs? When the up-spec (up-core-api) changes, it'll break the up-rust and affect other libraries depending on up-rust.

Actually, that is the main intention of referring to up-spec/main, i.e. we want to see that things have changed and we need to adapt up-rust ...

@@ -70,7 +37,7 @@ pub struct UMessageBuilder {
permission_level: Option<u32>,
comm_status: Option<EnumOrUnknown<UCode>>,
request_id: Option<UUID>,
payload: Option<Bytes>,
payload: Option<Vec<u8>>,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the reason for changing this? FMPOV Bytes is much more flexible when it comes to writing/reading and does require much less copying ...

)
})
) -> Result<UMessage, UMessageError> {
if !(self.payload_format == UPayloadFormat::UPAYLOAD_FORMAT_PROTOBUF
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where is self.payload_format set? Before your change, the payload format always was UPayloadFormat::UPAYLOAD_FORMAT_PROTOBUF. If we now want to also support UPayloadFormat::UPAYLOAD_FORMAT_PROTOBUF_WRAPPED_IN_ANY, then we either need to pass in the payload format as a param, add a dedicated function for building with wrapped payload or detect if the passed in payload actually is an Any. FMPOV we should go with option 2, making the whole thing very explicit and also making it very easy to later deprecate and remove support for it again ...

AnotherDaniel and others added 3 commits May 21, 2024 10:04
The UPayload structure has been removed from UMessage. The code has
been adapted accordingly.

Also-by: Kai Hudalla <kai.hudalla@bosch.com>
The Protobuf crate supports using Bytes instead of Vec<u8> when parsing
byte arrays from protobuf structs. This can help reduce copying of
data shared by multiple consumers of messages.

Protobuf's support for using Bytes has been enabled.
UMessageBuilder's functions for building with payload have been
adapted to accept any payload that can be converted to Bytes.
@sophokles73
Copy link
Contributor

@evshary Would you mind taking a look at the changes that I have pushed in addition to Daniel's original PR? @AnotherDaniel is on vacation this week and we agreed to get this merged this week ...

Copy link
Contributor

@sophokles73 sophokles73 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sophokles73
Copy link
Contributor

@evshary can you check if this (still) works for you?

@evshary
Copy link
Contributor

evshary commented May 21, 2024

@evshary can you check if this (still) works for you?

Yes, I give my pass to it.

@sophokles73 sophokles73 merged commit 1296dff into eclipse-uprotocol:main May 21, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants