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

make a new private mutex and add updating graph methods #73

Merged
merged 10 commits into from Nov 3, 2023

Conversation

iuhilnehc-ynos
Copy link

Its intent is to avoid using mutex directly outside, and decrease the replicated code about updating graph in RMWs.

Signed-off-by: Chen Lihui <lihui.chen@sony.com>
Chen Lihui added 3 commits October 17, 2023 14:49
Signed-off-by: Chen Lihui <lihui.chen@sony.com>
Signed-off-by: Chen Lihui <lihui.chen@sony.com>
Signed-off-by: Chen Lihui <lihui.chen@sony.com>
Signed-off-by: Chen Lihui <lihui.chen@sony.com>
@fujitatomoya
Copy link
Collaborator

@iuhilnehc-ynos is this still draft? please ping us when this and related PRs are ready to review. thanks in advance.

@iuhilnehc-ynos iuhilnehc-ynos marked this pull request as ready for review October 19, 2023 00:50
@iuhilnehc-ynos
Copy link
Author

Copy link

@eboasson eboasson left a comment

Choose a reason for hiding this comment

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

Looks ok to me, but I do wonder about two things.

Firstly, it appears to me that the publish_callback will typically always be the same, so perhaps it would make more sense to store set it when creating the context and not pass it as a parameter every time?

Secondly, I wonder about the naming: update and destroy. To me update sort-of implies it is already present, but I have no trouble accepting it as a shorthand for "update if present, insert if not". However, if the "update" part really means something, then the error handling is arguably incorrect. If it was present, the update succeeded, but the publishing failed: then arguably the entry should remain.

This error handling detailed in itself could be an argument for splitting "insert" and "update".

@iuhilnehc-ynos
Copy link
Author

@eboasson Thanks for your reply, I really appreciate it.

Firstly, it appears to me that the publish_callback will typically always be the same, so perhaps it would make more sense to store set it when creating the context and not pass it as a parameter every time?

Good idea.

Secondly, I wonder about the naming: update and destroy. To me update sort-of implies it is already present, but I have no trouble accepting it as a shorthand for "update if present, insert if not". However, if the "update" part really means something, then the error handling is arguably incorrect. If it was present, the update succeeded, but the publishing failed: then arguably the entry should remain.

There exists "// Update graph" comments before the original logic, I suppose using the "update_" name might be acceptable, regardless of whether the data is inserted or updated, if it already exists. I've used another "destroy_" method name to make it a bit clearer where entities are being destroyed.
The original logic was to remove the graph data if the publish message failed, so I decided to retain it.

Chen Lihui added 2 commits October 19, 2023 17:29
Signed-off-by: Chen Lihui <lihui.chen@sony.com>
Signed-off-by: Chen Lihui <lihui.chen@sony.com>
Copy link

@eboasson eboasson left a comment

Choose a reason for hiding this comment

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

Looks good to me (insofar as I am able to judge this given my limited knowledge of how the RMW layers I don't do anything with are put together 😂)

@iuhilnehc-ynos
Copy link
Author

iuhilnehc-ynos commented Oct 26, 2023

CI:

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Windows Build Status

Copy link
Contributor

@clalancette clalancette left a comment

Choose a reason for hiding this comment

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

Overall, I like the idea. I've left a few changes to think about.

rmw_dds_common/src/context.cpp Outdated Show resolved Hide resolved
rmw_dds_common/src/context.cpp Show resolved Hide resolved
rmw_dds_common/src/context.cpp Show resolved Hide resolved
rmw_dds_common/src/context.cpp Show resolved Hide resolved
rmw_dds_common/src/context.cpp Show resolved Hide resolved
Chen Lihui added 2 commits October 27, 2023 12:58
Signed-off-by: Chen Lihui <lihui.chen@sony.com>
Signed-off-by: Chen Lihui <lihui.chen@sony.com>
@iuhilnehc-ynos
Copy link
Author

CI:

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Windows Build Status

rmw_dds_common/src/context.cpp Outdated Show resolved Hide resolved
rmw_dds_common/src/context.cpp Outdated Show resolved Hide resolved
rmw_dds_common/src/context.cpp Outdated Show resolved Hide resolved
rmw_dds_common/include/rmw_dds_common/context.hpp Outdated Show resolved Hide resolved
Signed-off-by: Chen Lihui <lihui.chen@sony.com>
Copy link
Contributor

@clalancette clalancette left a comment

Choose a reason for hiding this comment

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

Looks good to me with green CI.

@iuhilnehc-ynos
Copy link
Author

CI:

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Windows Build Status

@clalancette clalancette merged commit 2273f38 into ros2:rolling Nov 3, 2023
3 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.

None yet

4 participants