apache / celix

Apache Celix is a framework for C and C++14 to develop dynamic modular software applications using component and in-process service-oriented programming.
https://celix.apache.org/
Apache License 2.0
158 stars 84 forks source link

Feature/87 add additional svc tracker bundle context funtions #729

Closed pnoltes closed 4 months ago

pnoltes commented 4 months ago

This pull request introduces several new bundle context C functions and C++ ServiceTracker methods. These additions allow tracked services to be called using callbacks on the current thread through a service tracker or service tracker ID. This method of calling services is expected to be more performant than the useService(s) functions/methods, which invoke callbacks on the event thread.

For C, the following functions where added:

The signature of the following C function has been changed:

For C++, the following methods were added:

This pull request also prepares the removal of celix_service_tracker.h as public api. This change should make it easier to refactor the celix_service_tracker.h and implementation for a better code coverage and error handling.

Also replaces the usage of hash_map_t in the C bundle context to celix_long_hash_map_t.

codecov-commenter commented 4 months ago

Codecov Report

Attention: Patch coverage is 88.98072% with 40 lines in your changes are missing coverage. Please review.

Project coverage is 89.65%. Comparing base (423abb8) to head (8ca876d). Report is 13 commits behind head on master.

Files Patch % Lines
libs/framework/src/service_tracker.c 78.94% 24 Missing :warning:
libs/framework/src/bundle_context.c 92.63% 14 Missing :warning:
libs/framework/include/celix/Trackers.h 96.77% 1 Missing :warning:
libs/framework/src/bundle.c 92.85% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #729 +/- ## ========================================== + Coverage 89.32% 89.65% +0.32% ========================================== Files 216 216 Lines 25153 25652 +499 ========================================== + Hits 22468 22998 +530 + Misses 2685 2654 -31 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

pnoltes commented 4 months ago

Currently it is not possible to call celix_bundleContext_trackServices* functions with a "use tracker service" callback (because a write lock is needed while holding a read lock). I think this can be enabled using a atomic use count, but I will do that in a separate PR.

For now I will merge this PR.