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

Dynamic introspection - introduce possibility to add and/or remove interfaces after a Node is being attached #46

Merged
merged 8 commits into from
May 13, 2024

Conversation

rgallor
Copy link
Collaborator

@rgallor rgallor commented Mar 28, 2024

Introduce two rpc to the MessageHub service: AddInterfaces and RemoveInterfaces, each receiving a list of JSON interfaces as input. The idea is to pass the list of interfaces to add/remove after a Node has been attached to the Message Hub. In particular, if the list of interfaces to add/remove is empty, no operation will be performed, otherwise for each interface the message hub will check which one should be added/removed. The Message Hub should "skip" the interfaces that have already been added or removed (hence, not found).

Close #8

Copy link
Collaborator

@harlem88 harlem88 left a comment

Choose a reason for hiding this comment

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

Add the rust & python code, generated from the latest changes of the proto files.
For the code generation you can follow the README file.

proto/astarteplatform/msghub/interface.proto Outdated Show resolved Hide resolved
@rgallor rgallor force-pushed the dynamic-introspection branch 3 times, most recently from c7eef47 to f8c5e60 Compare March 29, 2024 17:28
@rgallor rgallor force-pushed the dynamic-introspection branch 2 times, most recently from 731ad0b to 2b15f4f Compare April 10, 2024 16:08
Copy link
Contributor

@joshuachp joshuachp left a comment

Choose a reason for hiding this comment

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

I believe a better interface will be to have string for the InterfaceJson since:

  • in python we string encode() the interfaces which will write them as UTF-81
  • Rust strings are already checked to be UTF-8, so this will remove some "error" checks while marshaling the Vec<u8> of the interfaces

Footnotes

  1. https://docs.python.org/3/library/stdtypes.html#str.encode

@harlem88
Copy link
Collaborator

harlem88 commented Apr 19, 2024

I believe a better interface will be to have string for the InterfaceJson since:

  • in python we string encode() the interfaces which will write them as UTF-81
  • Rust strings are already checked to be UTF-8, so this will remove some "error" checks while marshaling the Vec<u8> of the interfaces

Footnotes

  1. https://docs.python.org/3/library/stdtypes.html#str.encode

JSON
While the specifications do not constrain the character encoding of the Unicode characters in a JSON text, the vast majority of implementations assume UTF-8 encoding; for interoperability, applications should always and only encode JSON messages in UTF-8.

So I believe we can switch to use String.

@rgallor rgallor force-pushed the dynamic-introspection branch 3 times, most recently from fd542dc to bdb5ddd Compare April 24, 2024 10:24
@rgallor rgallor force-pushed the dynamic-introspection branch 2 times, most recently from f518d5b to 565fef5 Compare April 29, 2024 14:04
Signed-off-by: rgallor <riccardo.gallo@secomind.com>
Signed-off-by: rgallor <riccardo.gallo@secomind.com>
Signed-off-by: rgallor <riccardo.gallo@secomind.com>
Signed-off-by: rgallor <riccardo.gallo@secomind.com>
Signed-off-by: rgallor <riccardo.gallo@secomind.com>
Signed-off-by: rgallor <riccardo.gallo@secomind.com>
@rgallor rgallor force-pushed the dynamic-introspection branch 4 times, most recently from 95bfa58 to 9cdbe35 Compare May 10, 2024 12:29
@harlem88 harlem88 requested a review from joshuachp May 10, 2024 12:53
Signed-off-by: rgallor <riccardo.gallo@secomind.com>
Signed-off-by: rgallor <riccardo.gallo@secomind.com>
@harlem88 harlem88 merged commit 474c143 into astarte-platform:master May 13, 2024
13 checks passed
@rgallor rgallor deleted the dynamic-introspection branch May 13, 2024 09:45
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.

Define API for supporting dynamic introspection
3 participants