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

Support node namespaces #95

Merged
merged 10 commits into from
Apr 8, 2017
Merged

Support node namespaces #95

merged 10 commits into from
Apr 8, 2017

Conversation

wjwwood
Copy link
Member

@wjwwood wjwwood commented Mar 29, 2017

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.

@wjwwood
Copy link
Member Author

wjwwood commented Mar 29, 2017

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.

@@ -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);
Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member

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.

Copy link
Member Author

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.

Copy link
Member Author

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.

@dirk-thomas
Copy link
Member

Can you please also create a PR for rmw_opensplice.

@wjwwood
Copy link
Member Author

wjwwood commented Mar 29, 2017

Why do I need to open a pr for opensplice?

@dirk-thomas
Copy link
Member

Why do I need to open a pr for opensplice?

Because we want to continue to be able to build with rmw_opensplice in order to test it in the future. Especially if the changes are as minimal as in this case.

@wjwwood
Copy link
Member Author

wjwwood commented Mar 30, 2017

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.

@wjwwood
Copy link
Member Author

wjwwood commented Apr 4, 2017

I rebased this after #93 was merged.

@wjwwood
Copy link
Member Author

wjwwood commented Apr 5, 2017

Ok, with two new pr's to fix linger issues I didn't see on my mac, here is CI post rebase:

  • Linux:
    • Build Status
  • macOS:
    • Build Status
  • Windows:
    • Build Status

Still looking for reviews for some of these pr's. Thanks!

@wjwwood
Copy link
Member Author

wjwwood commented Apr 5, 2017

@Karsten1987 can you review this pr too?

@wjwwood
Copy link
Member Author

wjwwood commented Apr 5, 2017

New CI after addressing comments:

  • Linux:
    • Build Status
  • macOS:
    • Build Status
  • Windows:
    • Build Status (the test failures appear to be unrelated/flaky)

Copy link
Member

@dirk-thomas dirk-thomas left a 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.

@@ -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
Copy link
Member

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?

Copy link
Member Author

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.

@wjwwood
Copy link
Member Author

wjwwood commented Apr 7, 2017

In 383db0f I added rmw_validate_namespace() as requested here: ros2/rcl#112 (comment)

In 383db0f I made invalid_index optional as requested here: ros2/rcl#112 (comment)

@wjwwood
Copy link
Member Author

wjwwood commented Apr 7, 2017

I believe all the comments on all pull requests have been addressed, I'm looking for final reviews. I'll probably merge later tonight if no one says anything.

Here's the latest CI:

  • Linux:
    • Build Status
  • Linux-aarch64:
    • Build Status
  • macOS:
    • Build Status
  • Windows:
    • Build Status (flaky python service requester test failure only)

break;
default:
RMW_SET_ERROR_MSG(
"rmw_validate_namespace(): unknown rmw_validate_topic_name() validation result"
Copy link
Member

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.

Copy link
Member Author

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

Copy link
Member

@dirk-thomas dirk-thomas left a 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.

@wjwwood
Copy link
Member Author

wjwwood commented Apr 8, 2017

Ok, I addressed all the comments and here is passing CI:

  • Linux:
    • Build Status
  • Linux-aarch64:
    • Build Status (existing test failures)
  • macOS:
    • Build Status
  • Windows:
    • Build Status (failing tests are flaky)

@wjwwood
Copy link
Member Author

wjwwood commented Apr 8, 2017

I'm going to go ahead and merge, if there are more comments I'll address them afterwards.

@wjwwood wjwwood merged commit c6145ce into master Apr 8, 2017
@wjwwood wjwwood deleted the node_namespace branch April 8, 2017 09:03
@wjwwood wjwwood removed the in review Waiting for review (Kanban column) label Apr 8, 2017
esteve added a commit to ros2-java/ros2_java that referenced this pull request Apr 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants