-
-
Notifications
You must be signed in to change notification settings - Fork 561
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
refactor(rust): enable requests to be messages #8783
Merged
etorreborre
merged 2 commits into
develop
from
etorreborre/refactoring/request-messages
Feb 12, 2025
Merged
refactor(rust): enable requests to be messages #8783
etorreborre
merged 2 commits into
develop
from
etorreborre/refactoring/request-messages
Feb 12, 2025
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fe1cc3f
to
5dd9725
Compare
84da455
to
153a866
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no performance regression but maybe we can avoid manually implementing every message
implementations/rust/ockam/ockam_api/src/influxdb/lease_token.rs
Outdated
Show resolved
Hide resolved
4af8b7b
to
8dde050
Compare
3d16cdd
to
53639d6
Compare
implementations/rust/ockam/ockam_api/src/nodes/service/tcp_inlets/node_manager_worker.rs
Show resolved
Hide resolved
53639d6
to
f3072f0
Compare
davide-baldo
approved these changes
Feb 12, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adjusts the serialization / deserialization of Ockam messages.
Motivation
The initial motivation was to be able to define
Request<T>
as a type ofMessage
for workers processing messages.Some additional objectives are to:
Encodable / Decodable
interfaces from theSerializable / Deserializable
implementations provided by theserde_bare
libraryRequests
are currently doubly-encoded, once as aVec<u8>
withminicbor
and then serialized withserde_bare
. Fixing this issue will be a one-line (or 2) change after this PR but it is a breaking change, so I left this for later.Changes
The main changes are:
Encodable
andDecodable
.Encodable
andDecodable
for aRequest<T>
provided thatT: Message
.Message
instance (that explains the number of touched files)ask/tell/request/...
methods for both requests and responses.Requests
in workers like theNodeManager
to:Request<Vec<u8>>
(now by the virtue ofRequest<T>
being aMessage
) in order to read theRequestHeader
.Decodable<T>
instance we know the expected type based on the header. Note that this is done without having to know that the request body was encoded usingminicbor
.