-
Notifications
You must be signed in to change notification settings - Fork 91
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
type support for properties #470
Conversation
…t_for_properties # Conflicts: # bundles/pubsub/pubsub_protocol/pubsub_protocol_lib/src/pubsub_wire_protocol_common.c
Nice! I'll have a detailed look at this. |
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #470 +/- ##
==========================================
+ Coverage 81.65% 83.12% +1.46%
==========================================
Files 252 254 +2
Lines 32559 32935 +376
==========================================
+ Hits 26587 27377 +790
+ Misses 5972 5558 -414 ☔ View full report in Codecov by Sentry. |
|
Note because this will be merged when Celix 3.0.0 is prepared also:
|
…t_for_properties # Conflicts: # libs/framework/include/celix/dm/DependencyManager_Impl.h # libs/framework/src/celix_launcher.c # libs/framework/src/service_reference.c # libs/utils/CMakeLists.txt # libs/utils/gtest/CMakeLists.txt # libs/utils/include/celix/Properties.h # libs/utils/include/celix_properties.h # libs/utils/include/celix_version.h # libs/utils/private/test/version_test.cpp # libs/utils/src/properties.c # libs/utils/src/version.c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An interface for testing (in)equality will be very handy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about we provide a unified way of serialization (e.g. netstring) so that it can be used for both file storage and EventAdmin?
I agree and I will also look into this when we start working on Celix 3.0.0. I also think we should (de)serialize with type information. |
…t_for_properties # Conflicts: # libs/utils/CMakeLists.txt # libs/utils/gtest/CMakeLists.txt # libs/utils/gtest/src/HashMapTestSuite.cc # libs/utils/include/celix/Exception.h # libs/utils/include/celix_properties.h # libs/utils/include/celix_utils.h # libs/utils/include/celix_version.h # libs/utils/private/test/properties_test.cpp # libs/utils/src/properties.c
…d on benchmark output Also add internal header for long/string hash map and properties so that hash map statistics can be extracted - in the project - for analysing purposes.
…he/celix into feature/type_support_for_properties
Also add some addition celix properties statistics.
Also add/improve some additional error handling in properties.
Also improve properties error handling
Ah i see, no this was not intentionally and I think it is better to keep the max iterator index on map size. Refactor the index increment for this. |
@PengZheng I think I reworked all the remarks. Could you re-review? |
In the original implementation, celix_autoptr(celix_string_hash_map_t) sMap = createStringHashMap(6);
auto iter1 = celix_stringHashMap_begin(sMap);
while (!celix_stringHashMapIterator_isEnd(&iter1)) {
if (iter1.index == 4) {
// note only removing entries where the iter key is even
celix_stringHashMapIterator_remove(&iter1);
} else {
celix_stringHashMapIterator_next(&iter1);
}
}
EXPECT_EQ(4, celix_stringHashMap_size(sMap)); 4 rather than 5 entries remain. The original implementation and well-defined meaning seems better. Sorry for misguiding you.
bool celix_stringHashMapIterator_isEnd(const celix_string_hash_map_iterator_t* iter) {
return iter->_internal[1] == NULL; //check if entry is NULL
}
bool celix_longHashMapIterator_isEnd(const celix_long_hash_map_iterator_t* iter) {
return iter->_internal[1] == NULL; //check if entry is NULL
} Therefore, it is also reasonable to remove |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only major issue left is the iterator index as mentioned above.
I apologize for the misguidance caused by misunderstanding.
Otherwise, this PR can be merged except for 2 minor issues:
#470 (review)
I agree. The index field is too confusion and it is trivial to add a counter/index on your own, so I removed the index field. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work. Now we have a more robutst, more efficient, and well-documented celix_properties_t
.
LGTM
This PR add some type support to
celix_properties_t
. Type support for properties are added so that #432 can be solved in type-aware manner.Looking at the LDAP spec, the filter attribute type should lead to the correct order comparison.
And because in Celix a "service.version" properties is used to identify the runtime version of a service, it should be possible to add a "service.version" property value as
celix_version_t
type so thatcelix_version_compareTo
can be used to compare "celix.version" attributes.For now I want to keep this PR draft, for 2 reasons:
But comments are welcome :)
Overview changes: