-
Notifications
You must be signed in to change notification settings - Fork 71
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
Support node namespaces #95
Conversation
Ok, now that I got all the pr's open, and took a second look at it, I think these are all ready for review and to be merged after #93. |
rmw/include/rmw/rmw.h
Outdated
@@ -88,7 +88,7 @@ rmw_init(void); | |||
RMW_PUBLIC | |||
RMW_WARN_UNUSED | |||
rmw_node_t * | |||
rmw_create_node(const char * name, size_t domain_id); | |||
rmw_create_node(const char * name, const char * name_space, size_t domain_id); |
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.
Shouldn't this be one word: namespace
?
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.
It's a keyword in c++ so when this header is included in cpp files it still fails to compile, even though this is inside an extern c block.
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.
That was an obvious one 🤕
I am not sure I like the idea of "separating" the variable name like this though. Some style guide recommend appending an underscore to names which collide with keywords (e.g. PEP 8). Even though this has the potential to collide with the C++ guide for class members I would prefer namespace_
over name_space
in this case.
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.
I agree, I'll go through and update all of the prs soon.
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.
Ok, I think I replaced all instances of name_space
with namespace_
in all the prs.
Can you please also create a PR for |
Why do I need to open a pr for opensplice? |
Because we want to continue to be able to build with |
I opened ros2/rmw_opensplice#164 and made this commit ros2/rmw_connext@2e65593 in order to move this all along, but honestly I think it's waste of time. I think we should rethink our policy of having opensplice and connext dynamic try to compile on a fresh clone, by disabling them in upstream with an AMENT_IGNORE, add a note to their README's telling people how to re-enable them, and have the farm remove those files when the options are selected. |
I rebased this after #93 was merged. |
@Karsten1987 can you review this pr too? |
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.
Beside the question this looks good to me.
rmw/include/rmw/validate_node_name.h
Outdated
@@ -37,7 +37,7 @@ extern "C" | |||
* | |||
* - must not be an empty string | |||
* - must only contain alphanumeric characters and underscores (a-z|A-Z|0-9|_) | |||
* - must not start with an number | |||
* - must start with an alphabetical character |
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.
Maybe I missed the discussion in another thread. Why do we want to prohibit node name starting with an underscore?
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.
I think I was just trying to simplify the rules, but I forgot about the underscores. The implementation didn't actually change. I'll switch it back b6f79db.
In 383db0f I added In 383db0f I made |
rmw/src/validate_namespace.c
Outdated
break; | ||
default: | ||
RMW_SET_ERROR_MSG( | ||
"rmw_validate_namespace(): unknown rmw_validate_topic_name() validation result" |
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.
It would be good to include the value of t_validation_result
in the error message.
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.
I think this should work, it does on macOS at least. I'll need to run CI again to check for warning on Windows: 833c760
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.
Beside the last comment this LGTM.
I'm going to go ahead and merge, if there are more comments I'll address them afterwards. |
This is the first change (as it includes the actual storage for the namespace) in a series of several changes up and down the stack. The purpose of these pull requests are to add the notion of a namespace for each node. This namespace will later be used to expand relative topic names and remapping rules.
This pr builds on #93 and include the commits from there. It should be rebased after that is merged.
This particular pr is relatively simple as it only adds storage for the namespace and adds it to the API for
rmw_create_node()
, see 14cd727.I'm going to leave this "in progress" until I get the other pull requests opened.