You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@celix.apache.org by GitBox <gi...@apache.org> on 2020/05/24 19:04:45 UTC

[GitHub] [celix] pnoltes opened a new pull request #244: Adds support for reserving service id

pnoltes opened a new pull request #244:
URL: https://github.com/apache/celix/pull/244


   This is added so that registering / unregistering service can be done (safely) outside of locks/mutexes.
   
   Note that although this is not part of the OSGi specification, IMO this is an added benefit for a native environment where memory deallocation can happen right after events are handled.
   
   See to log admin for an example of the use of a reserved service id. 


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [celix] codecov-commenter edited a comment on pull request #244: Adds support for reserving service id

Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #244:
URL: https://github.com/apache/celix/pull/244#issuecomment-633279422


   # [Codecov](https://codecov.io/gh/apache/celix/pull/244?src=pr&el=h1) Report
   > Merging [#244](https://codecov.io/gh/apache/celix/pull/244?src=pr&el=desc) into [master](https://codecov.io/gh/apache/celix/commit/f25f19f304d80caf2c41bd21580075a1e935b190&el=desc) will **increase** coverage by `0.28%`.
   > The diff coverage is `92.92%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/celix/pull/244/graphs/tree.svg?width=650&height=150&src=pr&token=JdsiThga8P)](https://codecov.io/gh/apache/celix/pull/244?src=pr&el=tree)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master     #244      +/-   ##
   ==========================================
   + Coverage   67.82%   68.11%   +0.28%     
   ==========================================
     Files         127      127              
     Lines       26375    26484     +109     
   ==========================================
   + Hits        17890    18040     +150     
   + Misses       8485     8444      -41     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/celix/pull/244?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [libs/framework/src/service\_tracker.c](https://codecov.io/gh/apache/celix/pull/244/diff?src=pr&el=tree#diff-bGlicy9mcmFtZXdvcmsvc3JjL3NlcnZpY2VfdHJhY2tlci5j) | `77.05% <50.00%> (-0.28%)` | :arrow_down: |
   | [libs/framework/src/framework.c](https://codecov.io/gh/apache/celix/pull/244/diff?src=pr&el=tree#diff-bGlicy9mcmFtZXdvcmsvc3JjL2ZyYW1ld29yay5j) | `75.47% <80.95%> (+0.17%)` | :arrow_up: |
   | [libs/framework/src/service\_registry.c](https://codecov.io/gh/apache/celix/pull/244/diff?src=pr&el=tree#diff-bGlicy9mcmFtZXdvcmsvc3JjL3NlcnZpY2VfcmVnaXN0cnkuYw==) | `73.10% <88.88%> (+1.29%)` | :arrow_up: |
   | [libs/framework/src/bundle\_context.c](https://codecov.io/gh/apache/celix/pull/244/diff?src=pr&el=tree#diff-bGlicy9mcmFtZXdvcmsvc3JjL2J1bmRsZV9jb250ZXh0LmM=) | `77.31% <97.85%> (+7.19%)` | :arrow_up: |
   | [bundles/logging/log\_admin/src/celix\_log\_admin.c](https://codecov.io/gh/apache/celix/pull/244/diff?src=pr&el=tree#diff-YnVuZGxlcy9sb2dnaW5nL2xvZ19hZG1pbi9zcmMvY2VsaXhfbG9nX2FkbWluLmM=) | `99.74% <100.00%> (+<0.01%)` | :arrow_up: |
   | [...gy\_manager/tms\_tst/disc\_mock/disc\_mock\_activator.c](https://codecov.io/gh/apache/celix/pull/244/diff?src=pr&el=tree#diff-YnVuZGxlcy9yZW1vdGVfc2VydmljZXMvdG9wb2xvZ3lfbWFuYWdlci90bXNfdHN0L2Rpc2NfbW9jay9kaXNjX21vY2tfYWN0aXZhdG9yLmM=) | `91.30% <100.00%> (+0.12%)` | :arrow_up: |
   | [libs/framework/src/bundle.c](https://codecov.io/gh/apache/celix/pull/244/diff?src=pr&el=tree#diff-bGlicy9mcmFtZXdvcmsvc3JjL2J1bmRsZS5j) | `68.22% <100.00%> (ø)` | |
   | [libs/utils/src/celix\_log\_utils.c](https://codecov.io/gh/apache/celix/pull/244/diff?src=pr&el=tree#diff-bGlicy91dGlscy9zcmMvY2VsaXhfbG9nX3V0aWxzLmM=) | `85.71% <100.00%> (+1.37%)` | :arrow_up: |
   | ... and [3 more](https://codecov.io/gh/apache/celix/pull/244/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/celix/pull/244?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/celix/pull/244?src=pr&el=footer). Last update [f25f19f...9698f62](https://codecov.io/gh/apache/celix/pull/244?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [celix] abroekhuis commented on a change in pull request #244: Adds support for reserving service id

Posted by GitBox <gi...@apache.org>.
abroekhuis commented on a change in pull request #244:
URL: https://github.com/apache/celix/pull/244#discussion_r435092917



##########
File path: libs/framework/include/celix_bundle_context.h
##########
@@ -126,8 +126,34 @@ typedef struct celix_service_registration_options {
      * for this.
      */
     const char *serviceVersion OPTS_INIT;
+
+    /**
+     * If set to > 0, this svc id will be used to register the service.
+     * The reservedSvcId should be reserved with a call to celix_bundleContext_reserveSvcId
+     */
+    long reservedSvcId OPTS_INIT;
 } celix_service_registration_options_t;
 
+/**
+ * Reserves a service id, which is expected to be used to register a service in the future.
+ *
+ * If a celix_bundleContext_unregisterService with the reserved service id is called earlier than
+ * the celix_bundleContext_registerServiceWithOptions with the reserved service. The registering
+ * of the service will be cancelled instead.

Review comment:
       What happens on subsequent calls to register? It is always and forever cancelled? If so, how to reclaim a svc Id?

##########
File path: libs/framework/include/celix_bundle_context.h
##########
@@ -47,7 +47,7 @@ extern "C" {
 * @param svc the service object. Normally a pointer to a service struct (i.e. a struct with function pointers)
 * @param serviceName the service name, cannot be NULL
 * @param properties The meta properties associated with the service. The service registration will take ownership of the properties (i.e. no destroy needed)
-* @return The serviceId (>= 0) or < 0 if the registration was unsuccessful.
+* @return The serviceId (>= 0), -1 if the registration was unsuccessful and -2 if the registration was cancel (only possible when using opts.reservedServiceId.

Review comment:
       The last part isn't clear to me. Can you elaborate it a bit?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [celix] pnoltes closed pull request #244: Adds support for reserving service id

Posted by GitBox <gi...@apache.org>.
pnoltes closed pull request #244:
URL: https://github.com/apache/celix/pull/244


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [celix] abroekhuis commented on a change in pull request #244: Adds support for reserving service id

Posted by GitBox <gi...@apache.org>.
abroekhuis commented on a change in pull request #244:
URL: https://github.com/apache/celix/pull/244#discussion_r435096268



##########
File path: libs/framework/include/celix_bundle_context.h
##########
@@ -47,7 +47,7 @@ extern "C" {
 * @param svc the service object. Normally a pointer to a service struct (i.e. a struct with function pointers)
 * @param serviceName the service name, cannot be NULL
 * @param properties The meta properties associated with the service. The service registration will take ownership of the properties (i.e. no destroy needed)
-* @return The serviceId (>= 0) or < 0 if the registration was unsuccessful.
+* @return The serviceId (>= 0), -1 if the registration was unsuccessful and -2 if the registration was cancel (only possible when using opts.reservedServiceId.

Review comment:
       I think cancel should be "cancelled". The doc on the reserve function made it clear.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [celix] abroekhuis commented on a change in pull request #244: Adds support for reserving service id

Posted by GitBox <gi...@apache.org>.
abroekhuis commented on a change in pull request #244:
URL: https://github.com/apache/celix/pull/244#discussion_r437626913



##########
File path: libs/framework/include/celix_bundle_context.h
##########
@@ -126,8 +126,38 @@ typedef struct celix_service_registration_options {
      * for this.
      */
     const char *serviceVersion OPTS_INIT;
+
+    /**
+     * If set to > 0, this svc id will be used to register the service.
+     * The reservedSvcId should be reserved with a call to celix_bundleContext_reserveSvcId
+     */
+    long reservedSvcId OPTS_INIT;
 } celix_service_registration_options_t;
 
+/**
+ * Reserves a service id, which is expected to be used to register a service in the future.
+ *
+ * If a celix_bundleContext_unregisterService with the reserved service id is called earlier than
+ * the celix_bundleContext_registerServiceWithOptions with the reserved service, the registration will be be cancelled.
+ * This means then when the expected celix_bundleContext_registerServiceWithOptions call happens this will not
+ * result in a service registration and a  -2 will be returned as service id.
+ *
+ * Subsequent calls to celix_bundleContext_registerServiceWithOptions for an already cancelled service id will
+ * return a -1 error code (and a 'Invalid reservedSvcId' error log entry will be logged).

Review comment:
       Shouldn't that be a -2?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [celix] abroekhuis commented on a change in pull request #244: Adds support for reserving service id

Posted by GitBox <gi...@apache.org>.
abroekhuis commented on a change in pull request #244:
URL: https://github.com/apache/celix/pull/244#discussion_r436774569



##########
File path: libs/framework/include/celix_bundle_context.h
##########
@@ -126,8 +126,34 @@ typedef struct celix_service_registration_options {
      * for this.
      */
     const char *serviceVersion OPTS_INIT;
+
+    /**
+     * If set to > 0, this svc id will be used to register the service.
+     * The reservedSvcId should be reserved with a call to celix_bundleContext_reserveSvcId
+     */
+    long reservedSvcId OPTS_INIT;
 } celix_service_registration_options_t;
 
+/**
+ * Reserves a service id, which is expected to be used to register a service in the future.
+ *
+ * If a celix_bundleContext_unregisterService with the reserved service id is called earlier than
+ * the celix_bundleContext_registerServiceWithOptions with the reserved service. The registering
+ * of the service will be cancelled instead.

Review comment:
       I think this needs to be added to the documentation.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [celix] codecov-commenter edited a comment on pull request #244: Adds support for reserving service id

Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #244:
URL: https://github.com/apache/celix/pull/244#issuecomment-633279422


   # [Codecov](https://codecov.io/gh/apache/celix/pull/244?src=pr&el=h1) Report
   > Merging [#244](https://codecov.io/gh/apache/celix/pull/244?src=pr&el=desc) into [master](https://codecov.io/gh/apache/celix/commit/0f2bb471d9fd5f8aeecfec06f74f41a7fc3093e5&el=desc) will **increase** coverage by `0.23%`.
   > The diff coverage is `92.92%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/celix/pull/244/graphs/tree.svg?width=650&height=150&src=pr&token=JdsiThga8P)](https://codecov.io/gh/apache/celix/pull/244?src=pr&el=tree)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master     #244      +/-   ##
   ==========================================
   + Coverage   67.82%   68.06%   +0.23%     
   ==========================================
     Files         127      127              
     Lines       26375    26484     +109     
   ==========================================
   + Hits        17890    18027     +137     
   + Misses       8485     8457      -28     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/celix/pull/244?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [libs/framework/src/service\_tracker.c](https://codecov.io/gh/apache/celix/pull/244/diff?src=pr&el=tree#diff-bGlicy9mcmFtZXdvcmsvc3JjL3NlcnZpY2VfdHJhY2tlci5j) | `77.05% <50.00%> (-0.28%)` | :arrow_down: |
   | [libs/framework/src/framework.c](https://codecov.io/gh/apache/celix/pull/244/diff?src=pr&el=tree#diff-bGlicy9mcmFtZXdvcmsvc3JjL2ZyYW1ld29yay5j) | `75.26% <80.95%> (-0.04%)` | :arrow_down: |
   | [libs/framework/src/service\_registry.c](https://codecov.io/gh/apache/celix/pull/244/diff?src=pr&el=tree#diff-bGlicy9mcmFtZXdvcmsvc3JjL3NlcnZpY2VfcmVnaXN0cnkuYw==) | `73.10% <88.88%> (+1.29%)` | :arrow_up: |
   | [libs/framework/src/bundle\_context.c](https://codecov.io/gh/apache/celix/pull/244/diff?src=pr&el=tree#diff-bGlicy9mcmFtZXdvcmsvc3JjL2J1bmRsZV9jb250ZXh0LmM=) | `77.31% <97.85%> (+7.19%)` | :arrow_up: |
   | [bundles/logging/log\_admin/src/celix\_log\_admin.c](https://codecov.io/gh/apache/celix/pull/244/diff?src=pr&el=tree#diff-YnVuZGxlcy9sb2dnaW5nL2xvZ19hZG1pbi9zcmMvY2VsaXhfbG9nX2FkbWluLmM=) | `99.74% <100.00%> (+<0.01%)` | :arrow_up: |
   | [...gy\_manager/tms\_tst/disc\_mock/disc\_mock\_activator.c](https://codecov.io/gh/apache/celix/pull/244/diff?src=pr&el=tree#diff-YnVuZGxlcy9yZW1vdGVfc2VydmljZXMvdG9wb2xvZ3lfbWFuYWdlci90bXNfdHN0L2Rpc2NfbW9jay9kaXNjX21vY2tfYWN0aXZhdG9yLmM=) | `91.30% <100.00%> (+0.12%)` | :arrow_up: |
   | [libs/framework/src/bundle.c](https://codecov.io/gh/apache/celix/pull/244/diff?src=pr&el=tree#diff-bGlicy9mcmFtZXdvcmsvc3JjL2J1bmRsZS5j) | `68.22% <100.00%> (ø)` | |
   | [libs/utils/src/celix\_log\_utils.c](https://codecov.io/gh/apache/celix/pull/244/diff?src=pr&el=tree#diff-bGlicy91dGlscy9zcmMvY2VsaXhfbG9nX3V0aWxzLmM=) | `85.71% <100.00%> (+1.37%)` | :arrow_up: |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/celix/pull/244?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/celix/pull/244?src=pr&el=footer). Last update [0f2bb47...9506d71](https://codecov.io/gh/apache/celix/pull/244?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [celix] pnoltes commented on pull request #244: Adds support for reserving service id

Posted by GitBox <gi...@apache.org>.
pnoltes commented on pull request #244:
URL: https://github.com/apache/celix/pull/244#issuecomment-657785007


   Replaced by the async service registration PR


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [celix] codecov-commenter edited a comment on pull request #244: Adds support for reserving service id

Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #244:
URL: https://github.com/apache/celix/pull/244#issuecomment-633279422


   # [Codecov](https://codecov.io/gh/apache/celix/pull/244?src=pr&el=h1) Report
   > Merging [#244](https://codecov.io/gh/apache/celix/pull/244?src=pr&el=desc) into [master](https://codecov.io/gh/apache/celix/commit/f25f19f304d80caf2c41bd21580075a1e935b190&el=desc) will **increase** coverage by `0.24%`.
   > The diff coverage is `92.92%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/celix/pull/244/graphs/tree.svg?width=650&height=150&src=pr&token=JdsiThga8P)](https://codecov.io/gh/apache/celix/pull/244?src=pr&el=tree)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master     #244      +/-   ##
   ==========================================
   + Coverage   67.82%   68.07%   +0.24%     
   ==========================================
     Files         127      127              
     Lines       26375    26484     +109     
   ==========================================
   + Hits        17890    18029     +139     
   + Misses       8485     8455      -30     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/celix/pull/244?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [libs/framework/src/service\_tracker.c](https://codecov.io/gh/apache/celix/pull/244/diff?src=pr&el=tree#diff-bGlicy9mcmFtZXdvcmsvc3JjL3NlcnZpY2VfdHJhY2tlci5j) | `76.86% <50.00%> (-0.46%)` | :arrow_down: |
   | [libs/framework/src/framework.c](https://codecov.io/gh/apache/celix/pull/244/diff?src=pr&el=tree#diff-bGlicy9mcmFtZXdvcmsvc3JjL2ZyYW1ld29yay5j) | `75.40% <80.95%> (+0.10%)` | :arrow_up: |
   | [libs/framework/src/service\_registry.c](https://codecov.io/gh/apache/celix/pull/244/diff?src=pr&el=tree#diff-bGlicy9mcmFtZXdvcmsvc3JjL3NlcnZpY2VfcmVnaXN0cnkuYw==) | `73.10% <88.88%> (+1.29%)` | :arrow_up: |
   | [libs/framework/src/bundle\_context.c](https://codecov.io/gh/apache/celix/pull/244/diff?src=pr&el=tree#diff-bGlicy9mcmFtZXdvcmsvc3JjL2J1bmRsZV9jb250ZXh0LmM=) | `77.31% <97.85%> (+7.19%)` | :arrow_up: |
   | [bundles/logging/log\_admin/src/celix\_log\_admin.c](https://codecov.io/gh/apache/celix/pull/244/diff?src=pr&el=tree#diff-YnVuZGxlcy9sb2dnaW5nL2xvZ19hZG1pbi9zcmMvY2VsaXhfbG9nX2FkbWluLmM=) | `99.74% <100.00%> (+<0.01%)` | :arrow_up: |
   | [...gy\_manager/tms\_tst/disc\_mock/disc\_mock\_activator.c](https://codecov.io/gh/apache/celix/pull/244/diff?src=pr&el=tree#diff-YnVuZGxlcy9yZW1vdGVfc2VydmljZXMvdG9wb2xvZ3lfbWFuYWdlci90bXNfdHN0L2Rpc2NfbW9jay9kaXNjX21vY2tfYWN0aXZhdG9yLmM=) | `91.30% <100.00%> (+0.12%)` | :arrow_up: |
   | [libs/framework/src/bundle.c](https://codecov.io/gh/apache/celix/pull/244/diff?src=pr&el=tree#diff-bGlicy9mcmFtZXdvcmsvc3JjL2J1bmRsZS5j) | `68.22% <100.00%> (ø)` | |
   | [libs/utils/src/celix\_log\_utils.c](https://codecov.io/gh/apache/celix/pull/244/diff?src=pr&el=tree#diff-bGlicy91dGlscy9zcmMvY2VsaXhfbG9nX3V0aWxzLmM=) | `85.71% <100.00%> (+1.37%)` | :arrow_up: |
   | ... and [3 more](https://codecov.io/gh/apache/celix/pull/244/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/celix/pull/244?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/celix/pull/244?src=pr&el=footer). Last update [f25f19f...c4f42e9](https://codecov.io/gh/apache/celix/pull/244?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [celix] codecov-commenter commented on pull request #244: Adds support for reserving service id

Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on pull request #244:
URL: https://github.com/apache/celix/pull/244#issuecomment-633279422


   # [Codecov](https://codecov.io/gh/apache/celix/pull/244?src=pr&el=h1) Report
   > Merging [#244](https://codecov.io/gh/apache/celix/pull/244?src=pr&el=desc) into [master](https://codecov.io/gh/apache/celix/commit/0f2bb471d9fd5f8aeecfec06f74f41a7fc3093e5&el=desc) will **increase** coverage by `0.24%`.
   > The diff coverage is `92.89%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/celix/pull/244/graphs/tree.svg?width=650&height=150&src=pr&token=JdsiThga8P)](https://codecov.io/gh/apache/celix/pull/244?src=pr&el=tree)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master     #244      +/-   ##
   ==========================================
   + Coverage   67.82%   68.07%   +0.24%     
   ==========================================
     Files         127      127              
     Lines       26375    26485     +110     
   ==========================================
   + Hits        17890    18029     +139     
   + Misses       8485     8456      -29     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/celix/pull/244?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [libs/framework/src/service\_tracker.c](https://codecov.io/gh/apache/celix/pull/244/diff?src=pr&el=tree#diff-bGlicy9mcmFtZXdvcmsvc3JjL3NlcnZpY2VfdHJhY2tlci5j) | `77.05% <50.00%> (-0.28%)` | :arrow_down: |
   | [libs/framework/src/framework.c](https://codecov.io/gh/apache/celix/pull/244/diff?src=pr&el=tree#diff-bGlicy9mcmFtZXdvcmsvc3JjL2ZyYW1ld29yay5j) | `75.28% <80.00%> (-0.03%)` | :arrow_down: |
   | [libs/framework/src/service\_registry.c](https://codecov.io/gh/apache/celix/pull/244/diff?src=pr&el=tree#diff-bGlicy9mcmFtZXdvcmsvc3JjL3NlcnZpY2VfcmVnaXN0cnkuYw==) | `73.10% <88.88%> (+1.29%)` | :arrow_up: |
   | [libs/framework/src/bundle\_context.c](https://codecov.io/gh/apache/celix/pull/244/diff?src=pr&el=tree#diff-bGlicy9mcmFtZXdvcmsvc3JjL2J1bmRsZV9jb250ZXh0LmM=) | `77.31% <97.85%> (+7.19%)` | :arrow_up: |
   | [bundles/logging/log\_admin/src/celix\_log\_admin.c](https://codecov.io/gh/apache/celix/pull/244/diff?src=pr&el=tree#diff-YnVuZGxlcy9sb2dnaW5nL2xvZ19hZG1pbi9zcmMvY2VsaXhfbG9nX2FkbWluLmM=) | `99.74% <100.00%> (+<0.01%)` | :arrow_up: |
   | [...gy\_manager/tms\_tst/disc\_mock/disc\_mock\_activator.c](https://codecov.io/gh/apache/celix/pull/244/diff?src=pr&el=tree#diff-YnVuZGxlcy9yZW1vdGVfc2VydmljZXMvdG9wb2xvZ3lfbWFuYWdlci90bXNfdHN0L2Rpc2NfbW9jay9kaXNjX21vY2tfYWN0aXZhdG9yLmM=) | `91.30% <100.00%> (+0.12%)` | :arrow_up: |
   | [libs/framework/src/bundle.c](https://codecov.io/gh/apache/celix/pull/244/diff?src=pr&el=tree#diff-bGlicy9mcmFtZXdvcmsvc3JjL2J1bmRsZS5j) | `68.22% <100.00%> (ø)` | |
   | [libs/utils/src/celix\_log\_utils.c](https://codecov.io/gh/apache/celix/pull/244/diff?src=pr&el=tree#diff-bGlicy91dGlscy9zcmMvY2VsaXhfbG9nX3V0aWxzLmM=) | `85.71% <100.00%> (+1.37%)` | :arrow_up: |
   | [libs/utils/src/hash\_map.c](https://codecov.io/gh/apache/celix/pull/244/diff?src=pr&el=tree#diff-bGlicy91dGlscy9zcmMvaGFzaF9tYXAuYw==) | `93.37% <0.00%> (+0.28%)` | :arrow_up: |
   | ... and [1 more](https://codecov.io/gh/apache/celix/pull/244/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/celix/pull/244?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/celix/pull/244?src=pr&el=footer). Last update [0f2bb47...819b9b2](https://codecov.io/gh/apache/celix/pull/244?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [celix] codecov-commenter edited a comment on pull request #244: Adds support for reserving service id

Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #244:
URL: https://github.com/apache/celix/pull/244#issuecomment-633279422


   # [Codecov](https://codecov.io/gh/apache/celix/pull/244?src=pr&el=h1) Report
   > Merging [#244](https://codecov.io/gh/apache/celix/pull/244?src=pr&el=desc) into [master](https://codecov.io/gh/apache/celix/commit/0f2bb471d9fd5f8aeecfec06f74f41a7fc3093e5&el=desc) will **increase** coverage by `0.24%`.
   > The diff coverage is `92.92%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/celix/pull/244/graphs/tree.svg?width=650&height=150&src=pr&token=JdsiThga8P)](https://codecov.io/gh/apache/celix/pull/244?src=pr&el=tree)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master     #244      +/-   ##
   ==========================================
   + Coverage   67.82%   68.07%   +0.24%     
   ==========================================
     Files         127      127              
     Lines       26375    26484     +109     
   ==========================================
   + Hits        17890    18029     +139     
   + Misses       8485     8455      -30     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/celix/pull/244?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [libs/framework/src/service\_tracker.c](https://codecov.io/gh/apache/celix/pull/244/diff?src=pr&el=tree#diff-bGlicy9mcmFtZXdvcmsvc3JjL3NlcnZpY2VfdHJhY2tlci5j) | `77.05% <50.00%> (-0.28%)` | :arrow_down: |
   | [libs/framework/src/framework.c](https://codecov.io/gh/apache/celix/pull/244/diff?src=pr&el=tree#diff-bGlicy9mcmFtZXdvcmsvc3JjL2ZyYW1ld29yay5j) | `75.40% <80.95%> (+0.10%)` | :arrow_up: |
   | [libs/framework/src/service\_registry.c](https://codecov.io/gh/apache/celix/pull/244/diff?src=pr&el=tree#diff-bGlicy9mcmFtZXdvcmsvc3JjL3NlcnZpY2VfcmVnaXN0cnkuYw==) | `73.10% <88.88%> (+1.29%)` | :arrow_up: |
   | [libs/framework/src/bundle\_context.c](https://codecov.io/gh/apache/celix/pull/244/diff?src=pr&el=tree#diff-bGlicy9mcmFtZXdvcmsvc3JjL2J1bmRsZV9jb250ZXh0LmM=) | `77.31% <97.85%> (+7.19%)` | :arrow_up: |
   | [bundles/logging/log\_admin/src/celix\_log\_admin.c](https://codecov.io/gh/apache/celix/pull/244/diff?src=pr&el=tree#diff-YnVuZGxlcy9sb2dnaW5nL2xvZ19hZG1pbi9zcmMvY2VsaXhfbG9nX2FkbWluLmM=) | `99.74% <100.00%> (+<0.01%)` | :arrow_up: |
   | [...gy\_manager/tms\_tst/disc\_mock/disc\_mock\_activator.c](https://codecov.io/gh/apache/celix/pull/244/diff?src=pr&el=tree#diff-YnVuZGxlcy9yZW1vdGVfc2VydmljZXMvdG9wb2xvZ3lfbWFuYWdlci90bXNfdHN0L2Rpc2NfbW9jay9kaXNjX21vY2tfYWN0aXZhdG9yLmM=) | `91.30% <100.00%> (+0.12%)` | :arrow_up: |
   | [libs/framework/src/bundle.c](https://codecov.io/gh/apache/celix/pull/244/diff?src=pr&el=tree#diff-bGlicy9mcmFtZXdvcmsvc3JjL2J1bmRsZS5j) | `68.22% <100.00%> (ø)` | |
   | [libs/utils/src/celix\_log\_utils.c](https://codecov.io/gh/apache/celix/pull/244/diff?src=pr&el=tree#diff-bGlicy91dGlscy9zcmMvY2VsaXhfbG9nX3V0aWxzLmM=) | `85.71% <100.00%> (+1.37%)` | :arrow_up: |
   | ... and [1 more](https://codecov.io/gh/apache/celix/pull/244/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/celix/pull/244?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/celix/pull/244?src=pr&el=footer). Last update [0f2bb47...9506d71](https://codecov.io/gh/apache/celix/pull/244?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [celix] pnoltes commented on a change in pull request #244: Adds support for reserving service id

Posted by GitBox <gi...@apache.org>.
pnoltes commented on a change in pull request #244:
URL: https://github.com/apache/celix/pull/244#discussion_r437689338



##########
File path: libs/framework/include/celix_bundle_context.h
##########
@@ -126,8 +126,38 @@ typedef struct celix_service_registration_options {
      * for this.
      */
     const char *serviceVersion OPTS_INIT;
+
+    /**
+     * If set to > 0, this svc id will be used to register the service.
+     * The reservedSvcId should be reserved with a call to celix_bundleContext_reserveSvcId
+     */
+    long reservedSvcId OPTS_INIT;
 } celix_service_registration_options_t;
 
+/**
+ * Reserves a service id, which is expected to be used to register a service in the future.
+ *
+ * If a celix_bundleContext_unregisterService with the reserved service id is called earlier than
+ * the celix_bundleContext_registerServiceWithOptions with the reserved service, the registration will be be cancelled.
+ * This means then when the expected celix_bundleContext_registerServiceWithOptions call happens this will not
+ * result in a service registration and a  -2 will be returned as service id.
+ *
+ * Subsequent calls to celix_bundleContext_registerServiceWithOptions for an already cancelled service id will
+ * return a -1 error code (and a 'Invalid reservedSvcId' error log entry will be logged).

Review comment:
       no,  Registering with a reserved id which is unknown gives a -1. Whether this is due to using an already cancelled reserved service id or "just" a invalid reserved service id is not tracked.
   
   So the bundle context keeps track of reserved service ids for future service registrations (to follow through with the registration or when cancelled skip the registration), but after that they are not tracked any more. 




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [celix] codecov-commenter edited a comment on pull request #244: Adds support for reserving service id

Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #244:
URL: https://github.com/apache/celix/pull/244#issuecomment-633279422


   # [Codecov](https://codecov.io/gh/apache/celix/pull/244?src=pr&el=h1) Report
   > Merging [#244](https://codecov.io/gh/apache/celix/pull/244?src=pr&el=desc) into [master](https://codecov.io/gh/apache/celix/commit/f25f19f304d80caf2c41bd21580075a1e935b190&el=desc) will **increase** coverage by `0.24%`.
   > The diff coverage is `92.92%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/celix/pull/244/graphs/tree.svg?width=650&height=150&src=pr&token=JdsiThga8P)](https://codecov.io/gh/apache/celix/pull/244?src=pr&el=tree)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master     #244      +/-   ##
   ==========================================
   + Coverage   67.82%   68.07%   +0.24%     
   ==========================================
     Files         127      127              
     Lines       26375    26484     +109     
   ==========================================
   + Hits        17890    18030     +140     
   + Misses       8485     8454      -31     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/celix/pull/244?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [libs/framework/src/service\_tracker.c](https://codecov.io/gh/apache/celix/pull/244/diff?src=pr&el=tree#diff-bGlicy9mcmFtZXdvcmsvc3JjL3NlcnZpY2VfdHJhY2tlci5j) | `77.05% <50.00%> (-0.28%)` | :arrow_down: |
   | [libs/framework/src/framework.c](https://codecov.io/gh/apache/celix/pull/244/diff?src=pr&el=tree#diff-bGlicy9mcmFtZXdvcmsvc3JjL2ZyYW1ld29yay5j) | `75.40% <80.95%> (+0.10%)` | :arrow_up: |
   | [libs/framework/src/service\_registry.c](https://codecov.io/gh/apache/celix/pull/244/diff?src=pr&el=tree#diff-bGlicy9mcmFtZXdvcmsvc3JjL3NlcnZpY2VfcmVnaXN0cnkuYw==) | `73.10% <88.88%> (+1.29%)` | :arrow_up: |
   | [libs/framework/src/bundle\_context.c](https://codecov.io/gh/apache/celix/pull/244/diff?src=pr&el=tree#diff-bGlicy9mcmFtZXdvcmsvc3JjL2J1bmRsZV9jb250ZXh0LmM=) | `77.31% <97.85%> (+7.19%)` | :arrow_up: |
   | [bundles/logging/log\_admin/src/celix\_log\_admin.c](https://codecov.io/gh/apache/celix/pull/244/diff?src=pr&el=tree#diff-YnVuZGxlcy9sb2dnaW5nL2xvZ19hZG1pbi9zcmMvY2VsaXhfbG9nX2FkbWluLmM=) | `99.74% <100.00%> (+<0.01%)` | :arrow_up: |
   | [...gy\_manager/tms\_tst/disc\_mock/disc\_mock\_activator.c](https://codecov.io/gh/apache/celix/pull/244/diff?src=pr&el=tree#diff-YnVuZGxlcy9yZW1vdGVfc2VydmljZXMvdG9wb2xvZ3lfbWFuYWdlci90bXNfdHN0L2Rpc2NfbW9jay9kaXNjX21vY2tfYWN0aXZhdG9yLmM=) | `91.30% <100.00%> (+0.12%)` | :arrow_up: |
   | [libs/framework/src/bundle.c](https://codecov.io/gh/apache/celix/pull/244/diff?src=pr&el=tree#diff-bGlicy9mcmFtZXdvcmsvc3JjL2J1bmRsZS5j) | `68.22% <100.00%> (ø)` | |
   | [libs/utils/src/celix\_log\_utils.c](https://codecov.io/gh/apache/celix/pull/244/diff?src=pr&el=tree#diff-bGlicy91dGlscy9zcmMvY2VsaXhfbG9nX3V0aWxzLmM=) | `85.71% <100.00%> (+1.37%)` | :arrow_up: |
   | ... and [2 more](https://codecov.io/gh/apache/celix/pull/244/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/celix/pull/244?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/celix/pull/244?src=pr&el=footer). Last update [f25f19f...c4f42e9](https://codecov.io/gh/apache/celix/pull/244?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [celix] abroekhuis commented on a change in pull request #244: Adds support for reserving service id

Posted by GitBox <gi...@apache.org>.
abroekhuis commented on a change in pull request #244:
URL: https://github.com/apache/celix/pull/244#discussion_r438622717



##########
File path: libs/framework/include/celix_bundle_context.h
##########
@@ -126,8 +126,38 @@ typedef struct celix_service_registration_options {
      * for this.
      */
     const char *serviceVersion OPTS_INIT;
+
+    /**
+     * If set to > 0, this svc id will be used to register the service.
+     * The reservedSvcId should be reserved with a call to celix_bundleContext_reserveSvcId
+     */
+    long reservedSvcId OPTS_INIT;
 } celix_service_registration_options_t;
 
+/**
+ * Reserves a service id, which is expected to be used to register a service in the future.
+ *
+ * If a celix_bundleContext_unregisterService with the reserved service id is called earlier than
+ * the celix_bundleContext_registerServiceWithOptions with the reserved service, the registration will be be cancelled.
+ * This means then when the expected celix_bundleContext_registerServiceWithOptions call happens this will not
+ * result in a service registration and a  -2 will be returned as service id.
+ *
+ * Subsequent calls to celix_bundleContext_registerServiceWithOptions for an already cancelled service id will
+ * return a -1 error code (and a 'Invalid reservedSvcId' error log entry will be logged).

Review comment:
       To me, this is confusing, so only the first registration will trigger a cancelled. That makes it unclear/vague for users to know what is going on if someone does a second registration for whatever reason. 




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [celix] pnoltes commented on a change in pull request #244: Adds support for reserving service id

Posted by GitBox <gi...@apache.org>.
pnoltes commented on a change in pull request #244:
URL: https://github.com/apache/celix/pull/244#discussion_r436742794



##########
File path: libs/framework/include/celix_bundle_context.h
##########
@@ -126,8 +126,34 @@ typedef struct celix_service_registration_options {
      * for this.
      */
     const char *serviceVersion OPTS_INIT;
+
+    /**
+     * If set to > 0, this svc id will be used to register the service.
+     * The reservedSvcId should be reserved with a call to celix_bundleContext_reserveSvcId
+     */
+    long reservedSvcId OPTS_INIT;
 } celix_service_registration_options_t;
 
+/**
+ * Reserves a service id, which is expected to be used to register a service in the future.
+ *
+ * If a celix_bundleContext_unregisterService with the reserved service id is called earlier than
+ * the celix_bundleContext_registerServiceWithOptions with the reserved service. The registering
+ * of the service will be cancelled instead.

Review comment:
       it always cancelled. subsequent call will return an error code (and log).
   You cannot reclaim the svc id. 




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [celix] codecov-commenter edited a comment on pull request #244: Adds support for reserving service id

Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #244:
URL: https://github.com/apache/celix/pull/244#issuecomment-633279422






----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org