rmw icon indicating copy to clipboard operation
rmw copied to clipboard

Change GID type in rmw_request_id_t and expectations for GIDs

Open jacobperron opened this issue 1 year ago • 2 comments

Replaces https://github.com/ros2/rmw/pull/329 Follow-up to https://github.com/ros2/rmw/pull/328


This PR contains two changes:

  • Use gid struct for request id Everywhere else in rmw, we use the type rmw_gid_t for global identifiers. For example, rmw_get_gid_for_publisher and rmw_get_gid_for_client. Furthermore, other global identifiers have a maximum size of 24 bytes, not 16 bytes. Changing the type and name of the client id in the rmw_request_id_t struct makes it consistent with other parts of the rmw API.

  • Update documented expectations for GIDs

    • Clarify that GIDs are globally unique within a ROS domain and consistent between processes/hosts.
    • Specify that any unused bytes in the GID should be set to zero (e.g. in cases where not all 24 bytes are used). This allows application code to directly compare GIDs without having to ask the middleware.

The latter change is especially useful for the proposed service introspection feature. E.g. if tooling wants to compare 24 byte GIDs, we want to ensure that any unused bytes are not set to garbage values and that they are consistent between processes and hosts.

If these changes are acceptable, I'll proceed in making the necessary changes to rmw implementations to:

  • Update any references to "writer_guid" to use the new "client_gid.data" member.
  • Ensure that they set unused bytes in the GID to zeros

jacobperron avatar Oct 13 '22 21:10 jacobperron