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

[#390] event based comm example #519

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

elfenpiff
Copy link
Contributor

@elfenpiff elfenpiff commented Nov 20, 2024

Notes for Reviewer

  • Adds the Rust-version of a more complex event-driven communication example. The idea is that the publisher and subscriber emit explicitly a user-defined event whenever they do something like connect/disconnect/sent sample/receive sample/request history etc. Based on that example a C++ example will follow in a follow up PR. In the example the ports are part of a more generic ExamplePublisher or ExampleSubscriber that also contain an notifier/listener to wait or emit events that are related to them. It also provides a first preview how a high-level iceoryx2 API could look like, where the event notification and the message transport are no longer separated.
  • Fixes a Bug in the WaitSet where it went into an infinite loop after the first deadline/interval has passed. The only thing here missing was to store the last time missed_deadlines was called in the deadline queue.

Pre-Review Checklist for the PR Author

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

Checklist for the PR Reviewer

  • Commits are properly organized and messages are according to the guideline
  • Unit tests have been written for new behavior
  • Public API is documented
  • PR title describes the changes

Post-review Checklist for the PR Author

  1. All open points are addressed and tracked via issues

References

Relates to #390
Closes #518

@elfenpiff elfenpiff self-assigned this Nov 20, 2024
Copy link

codecov bot commented Nov 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 78.86%. Comparing base (0c3b189) to head (dbf37d1).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #519      +/-   ##
==========================================
- Coverage   78.87%   78.86%   -0.02%     
==========================================
  Files         201      201              
  Lines       24219    24220       +1     
==========================================
- Hits        19103    19100       -3     
- Misses       5116     5120       +4     
Files with missing lines Coverage Δ
iceoryx2-bb/posix/src/deadline_queue.rs 89.51% <100.00%> (+0.07%) ⬆️

... and 5 files with indirect coverage changes

---- 🚨 Try these New Features:

Copy link
Member

@elBoberido elBoberido left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Just some nitpicks.

What do you think about adding an FD based event to the example, e.g. for unix domain sockets.

iceoryx2/tests/waitset_tests.rs Outdated Show resolved Hide resolved
examples/rust/_examples_common/pubsub_event.rs Outdated Show resolved Hide resolved
Comment on lines +103 to +105
self.notifier
.notify_with_custom_event_id(PubSubEvent::SentHistory.into())
.unwrap();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Philosophical question. Should the SentSample event also be triggert?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would not distinguish this. It is a simple example and the history may consist of N samples but then only 1 SentSample event was triggered which would be inconsistent.

examples/rust/event_based_communication/publisher.rs Outdated Show resolved Hide resolved
examples/rust/event_based_communication/subscriber.rs Outdated Show resolved Hide resolved
@elfenpiff elfenpiff removed the request for review from orecham November 21, 2024 08:14
@elBoberido elBoberido force-pushed the iox2-390-event-based-comm-example branch from faa7f5c to b46883b Compare November 21, 2024 20:18
@elfenpiff elfenpiff force-pushed the iox2-390-event-based-comm-example branch from 97dcaad to dbf37d1 Compare November 21, 2024 21:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

WaitSet goes into infinite loop when deadline was reached.
2 participants