eclipse-iceoryx / iceoryx2

Eclipse iceoryx2™ - true zero-copy inter-process-communication in pure Rust
https://iceoryx.io
Apache License 2.0
1.03k stars 40 forks source link

[#498] cleanup message type details #499

Closed elfenpiff closed 2 weeks ago

elfenpiff commented 2 weeks ago

Notes for Reviewer

In this PR the API used when overriding the MessageTypeDetails is strictly separated from the end user API.

The reason is, that in those cases the Sample and SampleMut handle the data a bit different. When calling Publisher::loan_custom_payload(123) and 123 corresponds to the number of elements, this number is stored in the samples header but Sample::payload().len() will return 123 * MessageTypeDetails::payload.size, the bytes used by the sample. When the MessageTypeDetails::payload.size is not overridden, Sample::payload().len() == Header::number_of_elements().

The publish subscribe header contains now the number_of_elements that are contained in the sample. The payload layout was removed. In the C API one can now easily obtain the underlying number of elements by just accessing this number directly from the header - no more payload.len() / sizeof(Payload) stuff.

Pre-Review Checklist for the PR Author

  1. [x] Add sensible notes for the reviewer
  2. [x] PR title is short, expressive and meaningful
  3. [x] Relevant issues are linked in the References section
  4. [x] Every source code file has a copyright header with SPDX-License-Identifier: Apache-2.0 OR MIT
  5. [x] Branch follows the naming format (iox2-123-introduce-posix-ipc-example)
  6. [x] Commits messages are according to this guideline
    • [x] Commit messages have the issue ID ([#123] Add posix ipc example)
    • [x] Commit author matches Eclipse Contributor Agreement (and ECA is signed)
  7. [x] Tests follow the best practice for testing
  8. [x] Changelog updated in the unreleased section including API breaking changes
  9. [x] Assign PR to reviewer
  10. [x] All checks have passed (except task-list-completed)

Checklist for the PR Reviewer

Post-review Checklist for the PR Author

  1. [x] All open points are addressed and tracked via issues

References

Closes #498

codecov[bot] commented 2 weeks ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 79.26%. Comparing base (29c71af) to head (6deb81b). Report is 6 commits behind head on main.

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/eclipse-iceoryx/iceoryx2/pull/499/graphs/tree.svg?width=650&height=150&src=pr&token=FN3YFXTJCI&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=eclipse-iceoryx)](https://app.codecov.io/gh/eclipse-iceoryx/iceoryx2/pull/499?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=eclipse-iceoryx) ```diff @@ Coverage Diff @@ ## main #499 +/- ## ========================================== + Coverage 79.21% 79.26% +0.05% ========================================== Files 200 200 Lines 23728 23762 +34 ========================================== + Hits 18795 18835 +40 + Misses 4933 4927 -6 ``` | [Files with missing lines](https://app.codecov.io/gh/eclipse-iceoryx/iceoryx2/pull/499?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=eclipse-iceoryx) | Coverage Δ | | |---|---|---| | [iceoryx2/src/port/publisher.rs](https://app.codecov.io/gh/eclipse-iceoryx/iceoryx2/pull/499?src=pr&el=tree&filepath=iceoryx2%2Fsrc%2Fport%2Fpublisher.rs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=eclipse-iceoryx#diff-aWNlb3J5eDIvc3JjL3BvcnQvcHVibGlzaGVyLnJz) | `85.09% <100.00%> (+0.15%)` | :arrow_up: | | [iceoryx2/src/port/subscriber.rs](https://app.codecov.io/gh/eclipse-iceoryx/iceoryx2/pull/499?src=pr&el=tree&filepath=iceoryx2%2Fsrc%2Fport%2Fsubscriber.rs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=eclipse-iceoryx#diff-aWNlb3J5eDIvc3JjL3BvcnQvc3Vic2NyaWJlci5ycw==) | `93.60% <100.00%> (+0.66%)` | :arrow_up: | | [iceoryx2/src/service/builder/publish\_subscribe.rs](https://app.codecov.io/gh/eclipse-iceoryx/iceoryx2/pull/499?src=pr&el=tree&filepath=iceoryx2%2Fsrc%2Fservice%2Fbuilder%2Fpublish_subscribe.rs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=eclipse-iceoryx#diff-aWNlb3J5eDIvc3JjL3NlcnZpY2UvYnVpbGRlci9wdWJsaXNoX3N1YnNjcmliZS5ycw==) | `90.60% <ø> (-0.94%)` | :arrow_down: | | [iceoryx2/src/service/header/publish\_subscribe.rs](https://app.codecov.io/gh/eclipse-iceoryx/iceoryx2/pull/499?src=pr&el=tree&filepath=iceoryx2%2Fsrc%2Fservice%2Fheader%2Fpublish_subscribe.rs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=eclipse-iceoryx#diff-aWNlb3J5eDIvc3JjL3NlcnZpY2UvaGVhZGVyL3B1Ymxpc2hfc3Vic2NyaWJlLnJz) | `100.00% <100.00%> (ø)` | | | [.../src/service/static\_config/message\_type\_details.rs](https://app.codecov.io/gh/eclipse-iceoryx/iceoryx2/pull/499?src=pr&el=tree&filepath=iceoryx2%2Fsrc%2Fservice%2Fstatic_config%2Fmessage_type_details.rs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=eclipse-iceoryx#diff-aWNlb3J5eDIvc3JjL3NlcnZpY2Uvc3RhdGljX2NvbmZpZy9tZXNzYWdlX3R5cGVfZGV0YWlscy5ycw==) | `100.00% <100.00%> (ø)` | | ... and [11 files with indirect coverage changes](https://app.codecov.io/gh/eclipse-iceoryx/iceoryx2/pull/499/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=eclipse-iceoryx)