-
Notifications
You must be signed in to change notification settings - Fork 42
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
Finish GraphCache implementation for Pub/Sub #66
Conversation
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.
Great Job @Yadunund 🚀
I left a bunch of not-game-changing comments, ptal
auto erase_it = found_node->pubs.begin(); | ||
for (; erase_it != found_node->pubs.end(); ++erase_it) { | ||
const auto & pub = *erase_it; | ||
if (pub.topic == node->pubs.at(0).topic && | ||
pub.type == node->pubs.at(0).type && | ||
pub.qos == node->pubs.at(0).qos) | ||
{ | ||
break; | ||
} | ||
} |
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.
nit: use find_if
here and there
auto erase_it = found_node->pubs.begin(); | |
for (; erase_it != found_node->pubs.end(); ++erase_it) { | |
const auto & pub = *erase_it; | |
if (pub.topic == node->pubs.at(0).topic && | |
pub.type == node->pubs.at(0).type && | |
pub.qos == node->pubs.at(0).qos) | |
{ | |
break; | |
} | |
} | |
auto erase_it = std::find_if(found_node->pubs.begin(), found_node->pubs.end(), [&node](const auto &pub) { | |
return pub.topic == node->pubs.at(0).topic && | |
pub.type == node->pubs.at(0).type && | |
pub.qos == node->pubs.at(0).qos; | |
}); |
Then proceed as you do:
if (erase_it != found_node->pubs.end()) {
// Found a matching element, erase it
found_node->pubs.erase(erase_it);
//...
//...
//...
}
Signed-off-by: Yadunund <[email protected]>
Signed-off-by: Yadunund <[email protected]>
Signed-off-by: Yadunund <[email protected]>
Signed-off-by: Yadunund <[email protected]>
Signed-off-by: Yadunund <[email protected]>
* Switch to liveliness tokens Signed-off-by: Yadunund <[email protected]> * Use zc APIs instead of macros to resolve liveliness api issues Signed-off-by: Yadunund <[email protected]> --------- Signed-off-by: Yadunund <[email protected]>
Signed-off-by: Yadunund <[email protected]>
Signed-off-by: Yadunund <[email protected]>
Signed-off-by: Yadunund <[email protected]>
Signed-off-by: Yadunund <[email protected]>
When playing around with this I found that the types weren't being properly filled in, and also weren't being demangled. Fix both of those things here, as well as do a lot of cleanup. Signed-off-by: Chris Lalancette <[email protected]>
a0f47b1
to
f7711c7
Compare
I ended up rebasing this on the latest, as well as fixing some bugs that I found. I also addressed most of @francocipollone 's comments, with the exception of a switch to However, with all of that done, |
Confirmed, it is working correctly. It seems it was my bad: I had some issues with the |
Thanks for cleaning this up Chris! I'll work on massaging the cache data structures to support multiple types on the same topic in a separate PR to keep the diffs minimal. If both of you are okay with the code here, should we merge this in first? |
Signed-off-by: Yadunund <[email protected]>
Yeah, I think we should do that. The open issues here are 1) to switch to find_if as suggested by Franco, and 2) fix multiple types per topic. As long as we fix both of those in a follow-up, I'm good with merging this. |
* Add storage plugin config to router config Signed-off-by: Yadunund <[email protected]> * Fix non empty node namespace Signed-off-by: Yadunund <[email protected]> * Rely on unordered_map instead of yaml for graph cache Signed-off-by: Yadunund <[email protected]> * Update graph cache with publisher data Signed-off-by: Yadunund <[email protected]> * Implement basic publisher introspection Signed-off-by: Yadunund <[email protected]> * Switch to liveliness tokens (#67) * Switch to liveliness tokens Signed-off-by: Yadunund <[email protected]> * Use zc APIs instead of macros to resolve liveliness api issues Signed-off-by: Yadunund <[email protected]> --------- Signed-off-by: Yadunund <[email protected]> * Cleanup yaml-cpp Signed-off-by: Yadunund <[email protected]> * Cleanup previous graph cache impl Signed-off-by: Yadunund <[email protected]> * Refactor topic cache Signed-off-by: Yadunund <[email protected]> * Implement liveliness tokens for subscriptions and update graph Signed-off-by: Yadunund <[email protected]> * Fix types and type mangling. When playing around with this I found that the types weren't being properly filled in, and also weren't being demangled. Fix both of those things here, as well as do a lot of cleanup. Signed-off-by: Chris Lalancette <[email protected]> * Update README Signed-off-by: Yadunund <[email protected]> --------- Signed-off-by: Yadunund <[email protected]> Signed-off-by: Chris Lalancette <[email protected]> Co-authored-by: Chris Lalancette <[email protected]>
This PR:
GraphCache
within each session. Specifically we move away from aYAML::Node
to anunordered_map
(although implementing a conversion from our custom map toYAML
may be helpful for logging or transmitting the graph as a serializedYAML
over the network).zenoh-pico
.rmw
(the rest will be done in a separate PR).