Add CEcalRegistrationDatabase core, direct mutation API, and initial GTests#3
Conversation
| #include <utility> | ||
|
|
||
| namespace eCAL | ||
| { |
There was a problem hiding this comment.
warning: nested namespaces can be concatenated [modernize-concat-nested-namespaces]
| { |
ecal/core/src/registration/ecal_registration_database.cpp:25:
- namespace Registration
+ namespace eCAL::Registrationecal/core/src/registration/ecal_registration_database.cpp:450:
- }
| return ApplyMutation([key_, &delta_](State& state_, std::vector<EntityEvent>&, bool& changed_) | ||
| { | ||
| auto it = state_.process_monitoring.find(key_); | ||
| if (it == state_.process_monitoring.end() || !(it->second.state == delta_.state && it->second.time_sync_state == delta_.time_sync_state)) |
There was a problem hiding this comment.
warning: boolean expression can be simplified by DeMorgan's theorem [readability-simplify-boolean-expr]
| if (it == state_.process_monitoring.end() || !(it->second.state == delta_.state && it->second.time_sync_state == delta_.time_sync_state)) | |
| if (it == state_.process_monitoring.end() || !it->second.state == delta_.state || it->second.time_sync_state != delta_.time_sync_state) |
| auto it = state_.REG_MAP.find(key_); if (it != state_.REG_MAP.end()) { RemoveMembership(state_.members_by_process, it->second.process_id, EntityType::TYPE_ENUM, key_); state_.REG_MAP.erase(it); state_.MON_MAP.erase(key_); events_.push_back({ EventType::deleted_entity, EntityType::TYPE_ENUM, key_ }); changed_ = true; } \ | ||
| }); } | ||
|
|
||
| ECAL_REGDB_ADD_UPDATE_REMOVE_TOPIC(Publisher, publisher, publishers, publisher_monitoring) |
There was a problem hiding this comment.
warning: boolean expression can be simplified by DeMorgan's theorem [readability-simplify-boolean-expr]
ECAL_REGDB_ADD_UPDATE_REMOVE_TOPIC(Publisher, publisher, publishers, publisher_monitoring)
^Additional context
ecal/core/src/registration/ecal_registration_database.cpp:237: expanded from macro 'ECAL_REGDB_ADD_UPDATE_REMOVE_TOPIC'
else if (!(it->second.topic == delta_.topic && it->second.process_id == delta_.process_id && it->second.host_name == delta_.host_name)) { \
^| }); } | ||
|
|
||
| ECAL_REGDB_ADD_UPDATE_REMOVE_TOPIC(Publisher, publisher, publishers, publisher_monitoring) | ||
| ECAL_REGDB_ADD_UPDATE_REMOVE_TOPIC(Subscriber, subscriber, subscribers, subscriber_monitoring) |
There was a problem hiding this comment.
warning: boolean expression can be simplified by DeMorgan's theorem [readability-simplify-boolean-expr]
ECAL_REGDB_ADD_UPDATE_REMOVE_TOPIC(Subscriber, subscriber, subscribers, subscriber_monitoring)
^Additional context
ecal/core/src/registration/ecal_registration_database.cpp:237: expanded from macro 'ECAL_REGDB_ADD_UPDATE_REMOVE_TOPIC'
else if (!(it->second.topic == delta_.topic && it->second.process_id == delta_.process_id && it->second.host_name == delta_.host_name)) { \
^| events_.push_back({ EventType::new_entity, EntityType::server, key_ }); | ||
| changed_ = true; | ||
| } | ||
| else if (!(it->second.service == delta_.service && it->second.process_id == delta_.process_id && it->second.host_name == delta_.host_name)) |
There was a problem hiding this comment.
warning: boolean expression can be simplified by DeMorgan's theorem [readability-simplify-boolean-expr]
| else if (!(it->second.service == delta_.service && it->second.process_id == delta_.process_id && it->second.host_name == delta_.host_name)) | |
| else if (!it->second.service == delta_.service || it->second.process_id != delta_.process_id || !it->second.host_name == delta_.host_name) |
| bool HasSubscriber(EntityKey key) const; | ||
| bool HasServer(EntityKey key) const; | ||
| bool HasClient(EntityKey key) const; | ||
| size_t ProcessCount() const; |
There was a problem hiding this comment.
warning: function 'ProcessCount' should be marked [[nodiscard]] [modernize-use-nodiscard]
| size_t ProcessCount() const; | |
| [[nodiscard]] size_t ProcessCount() const; |
| bool HasServer(EntityKey key) const; | ||
| bool HasClient(EntityKey key) const; | ||
| size_t ProcessCount() const; | ||
| size_t PublisherCount() const; |
There was a problem hiding this comment.
warning: function 'PublisherCount' should be marked [[nodiscard]] [modernize-use-nodiscard]
| size_t PublisherCount() const; | |
| [[nodiscard]] size_t PublisherCount() const; |
| bool HasClient(EntityKey key) const; | ||
| size_t ProcessCount() const; | ||
| size_t PublisherCount() const; | ||
| size_t SubscriberCount() const; |
There was a problem hiding this comment.
warning: function 'SubscriberCount' should be marked [[nodiscard]] [modernize-use-nodiscard]
| size_t SubscriberCount() const; | |
| [[nodiscard]] size_t SubscriberCount() const; |
| size_t ProcessCount() const; | ||
| size_t PublisherCount() const; | ||
| size_t SubscriberCount() const; | ||
| size_t ServerCount() const; |
There was a problem hiding this comment.
warning: function 'ServerCount' should be marked [[nodiscard]] [modernize-use-nodiscard]
| size_t ServerCount() const; | |
| [[nodiscard]] size_t ServerCount() const; |
| size_t PublisherCount() const; | ||
| size_t SubscriberCount() const; | ||
| size_t ServerCount() const; | ||
| size_t ClientCount() const; |
There was a problem hiding this comment.
warning: function 'ClientCount' should be marked [[nodiscard]] [modernize-use-nodiscard]
| size_t ClientCount() const; | |
| [[nodiscard]] size_t ClientCount() const; |
| #include <utility> | ||
|
|
||
| namespace eCAL | ||
| { |
There was a problem hiding this comment.
warning: nested namespaces can be concatenated [modernize-concat-nested-namespaces]
| { |
ecal/core/src/registration/ecal_registration_database.cpp:25:
- namespace Registration
+ namespace eCAL::Registrationecal/core/src/registration/ecal_registration_database.cpp:450:
- }
| return ApplyMutation([key_, &delta_](State& state_, std::vector<EntityEvent>&, bool& changed_) | ||
| { | ||
| auto it = state_.process_monitoring.find(key_); | ||
| if (it == state_.process_monitoring.end() || !(it->second.state == delta_.state && it->second.time_sync_state == delta_.time_sync_state)) |
There was a problem hiding this comment.
warning: boolean expression can be simplified by DeMorgan's theorem [readability-simplify-boolean-expr]
| if (it == state_.process_monitoring.end() || !(it->second.state == delta_.state && it->second.time_sync_state == delta_.time_sync_state)) | |
| if (it == state_.process_monitoring.end() || !it->second.state == delta_.state || it->second.time_sync_state != delta_.time_sync_state) |
| auto it = state_.REG_MAP.find(key_); if (it != state_.REG_MAP.end()) { RemoveMembership(state_.members_by_process, it->second.process_id, EntityType::TYPE_ENUM, key_); state_.REG_MAP.erase(it); state_.MON_MAP.erase(key_); events_.push_back({ EventType::deleted_entity, EntityType::TYPE_ENUM, key_ }); changed_ = true; } \ | ||
| }); } | ||
|
|
||
| ECAL_REGDB_ADD_UPDATE_REMOVE_TOPIC(Publisher, publisher, publishers, publisher_monitoring) |
There was a problem hiding this comment.
warning: boolean expression can be simplified by DeMorgan's theorem [readability-simplify-boolean-expr]
ECAL_REGDB_ADD_UPDATE_REMOVE_TOPIC(Publisher, publisher, publishers, publisher_monitoring)
^Additional context
ecal/core/src/registration/ecal_registration_database.cpp:237: expanded from macro 'ECAL_REGDB_ADD_UPDATE_REMOVE_TOPIC'
else if (!(it->second.topic == delta_.topic && it->second.process_id == delta_.process_id && it->second.host_name == delta_.host_name)) { \
^| }); } | ||
|
|
||
| ECAL_REGDB_ADD_UPDATE_REMOVE_TOPIC(Publisher, publisher, publishers, publisher_monitoring) | ||
| ECAL_REGDB_ADD_UPDATE_REMOVE_TOPIC(Subscriber, subscriber, subscribers, subscriber_monitoring) |
There was a problem hiding this comment.
warning: boolean expression can be simplified by DeMorgan's theorem [readability-simplify-boolean-expr]
ECAL_REGDB_ADD_UPDATE_REMOVE_TOPIC(Subscriber, subscriber, subscribers, subscriber_monitoring)
^Additional context
ecal/core/src/registration/ecal_registration_database.cpp:237: expanded from macro 'ECAL_REGDB_ADD_UPDATE_REMOVE_TOPIC'
else if (!(it->second.topic == delta_.topic && it->second.process_id == delta_.process_id && it->second.host_name == delta_.host_name)) { \
^| events_.push_back({ EventType::new_entity, EntityType::server, key_ }); | ||
| changed_ = true; | ||
| } | ||
| else if (!(it->second.service == delta_.service && it->second.process_id == delta_.process_id && it->second.host_name == delta_.host_name)) |
There was a problem hiding this comment.
warning: boolean expression can be simplified by DeMorgan's theorem [readability-simplify-boolean-expr]
| else if (!(it->second.service == delta_.service && it->second.process_id == delta_.process_id && it->second.host_name == delta_.host_name)) | |
| else if (!it->second.service == delta_.service || it->second.process_id != delta_.process_id || !it->second.host_name == delta_.host_name) |
| bool HasSubscriber(EntityKey key) const; | ||
| bool HasServer(EntityKey key) const; | ||
| bool HasClient(EntityKey key) const; | ||
| size_t ProcessCount() const; |
There was a problem hiding this comment.
warning: function 'ProcessCount' should be marked [[nodiscard]] [modernize-use-nodiscard]
| size_t ProcessCount() const; | |
| [[nodiscard]] size_t ProcessCount() const; |
| bool HasServer(EntityKey key) const; | ||
| bool HasClient(EntityKey key) const; | ||
| size_t ProcessCount() const; | ||
| size_t PublisherCount() const; |
There was a problem hiding this comment.
warning: function 'PublisherCount' should be marked [[nodiscard]] [modernize-use-nodiscard]
| size_t PublisherCount() const; | |
| [[nodiscard]] size_t PublisherCount() const; |
| bool HasClient(EntityKey key) const; | ||
| size_t ProcessCount() const; | ||
| size_t PublisherCount() const; | ||
| size_t SubscriberCount() const; |
There was a problem hiding this comment.
warning: function 'SubscriberCount' should be marked [[nodiscard]] [modernize-use-nodiscard]
| size_t SubscriberCount() const; | |
| [[nodiscard]] size_t SubscriberCount() const; |
| size_t ProcessCount() const; | ||
| size_t PublisherCount() const; | ||
| size_t SubscriberCount() const; | ||
| size_t ServerCount() const; |
There was a problem hiding this comment.
warning: function 'ServerCount' should be marked [[nodiscard]] [modernize-use-nodiscard]
| size_t ServerCount() const; | |
| [[nodiscard]] size_t ServerCount() const; |
| size_t PublisherCount() const; | ||
| size_t SubscriberCount() const; | ||
| size_t ServerCount() const; | ||
| size_t ClientCount() const; |
There was a problem hiding this comment.
warning: function 'ClientCount' should be marked [[nodiscard]] [modernize-use-nodiscard]
| size_t ClientCount() const; | |
| [[nodiscard]] size_t ClientCount() const; |
Motivation
Registration::Sampleobjects everywhere by providing a deserializer-friendly direct mutation API for registration updates to reduce deserialization cost and duplicated state reconstruction.Description
CEcalRegistrationDatabaseinecal/core/src/registration/with split registration vs monitoring stores,current+previousrevision tracking, snapshot read semantics, and process-member tracking (ecal_registration_database.h/.cpp).AddOrUpdate*/Update*Monitoring/Remove*) and sample compatibility adapters (ApplySample/ApplySamples) which map incomingRegistration::Samplecommands to the direct APIs.ecal/core/CMakeLists.txtand added initial GTests inecal/tests/cpp/registration_test/src/registration_database_test.cpp, and wired the test intoecal/tests/cpp/registration_test/CMakeLists.txt.Testing
g++ -std=c++14 -fsyntax-onlywhich succeeded forecal_registration_database.cpp.cmake --preset corebut configuration failed due to missing third-party submodule trees in the environment (so project-level build and test execution were not possible).gtest/gtest.his not available, so the added GTests were not executed here.ApplySamplevs direct-mutation equivalence for publisher ingestion, process cascade deletion behavior, andcurrent/previousrevision tracking and are included for CI to run when third-party/test dependencies are available.Codex Task