From 9a8d53721e9a9f808eab4947f6211834202761ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20Fu=C3=9Fberger?= Date: Fri, 5 Jun 2026 13:46:02 +0200 Subject: [PATCH 01/18] Rename Monitor to Alive API --- .../alive_monitor/{Monitor.cpp => Alive.cpp} | 8 ++-- .../src/alive_monitor/{Monitor.h => Alive.h} | 38 +++++++++---------- .../daemon/src/alive_monitor/BUILD | 8 ++-- .../src/alive_monitor/MonitorImplWrapper.cpp | 2 +- .../src/alive_monitor/details/MonitorImpl.h | 2 +- 5 files changed, 29 insertions(+), 29 deletions(-) rename score/launch_manager/daemon/src/alive_monitor/{Monitor.cpp => Alive.cpp} (75%) rename score/launch_manager/daemon/src/alive_monitor/{Monitor.h => Alive.h} (81%) diff --git a/score/launch_manager/daemon/src/alive_monitor/Monitor.cpp b/score/launch_manager/daemon/src/alive_monitor/Alive.cpp similarity index 75% rename from score/launch_manager/daemon/src/alive_monitor/Monitor.cpp rename to score/launch_manager/daemon/src/alive_monitor/Alive.cpp index f5d9b5836..84ee897c6 100644 --- a/score/launch_manager/daemon/src/alive_monitor/Monitor.cpp +++ b/score/launch_manager/daemon/src/alive_monitor/Alive.cpp @@ -11,7 +11,7 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -#include "score/mw/launch_manager/alive_monitor/Monitor.h" +#include "score/mw/launch_manager/alive_monitor/Alive.h" enum class Dummy : std::uint32_t {}; @@ -21,7 +21,7 @@ extern "C" { void* score_lcm_monitor_initialize(const char* instanceSpecifier) noexcept { try { - auto* monitorPtr = new score::mw::lifecycle::Monitor(instanceSpecifier); + auto* monitorPtr = new score::mw::lifecycle::Alive(instanceSpecifier); return static_cast(monitorPtr); } catch (...) { return nullptr; @@ -29,12 +29,12 @@ void* score_lcm_monitor_initialize(const char* instanceSpecifier) noexcept { } void score_lcm_monitor_deinitialize(void* instance) noexcept { - auto* monitorPtr = static_cast*>(instance); + auto* monitorPtr = static_cast*>(instance); delete monitorPtr; } void score_lcm_monitor_report_checkpoint(void* instance, std::uint32_t checkpointId) noexcept { - static_cast*>(instance)->ReportCheckpoint(static_cast(checkpointId)); + static_cast*>(instance)->ReportCheckpoint(static_cast(checkpointId)); } #ifdef __cplusplus diff --git a/score/launch_manager/daemon/src/alive_monitor/Monitor.h b/score/launch_manager/daemon/src/alive_monitor/Alive.h similarity index 81% rename from score/launch_manager/daemon/src/alive_monitor/Monitor.h rename to score/launch_manager/daemon/src/alive_monitor/Alive.h index a007ad784..afca235bd 100644 --- a/score/launch_manager/daemon/src/alive_monitor/Monitor.h +++ b/score/launch_manager/daemon/src/alive_monitor/Alive.h @@ -11,8 +11,8 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -#ifndef SCORE_LCM_MONITOR_H_ -#define SCORE_LCM_MONITOR_H_ +#ifndef SCORE_LCM_ALIVE_H_ +#define SCORE_LCM_ALIVE_H_ #include #include @@ -24,13 +24,13 @@ namespace score::mw::lifecycle { -/// @brief Monitor Class +/// @brief Alive Class template -class Monitor +class Alive { public: - /// @brief Creation of a Monitor. - /// @param [in] instance Instance specifier of the Monitor + /// @brief Creation of an Alive. + /// @param [in] instance Instance specifier of the Alive /// @throws std::runtime_error in case of an error loading the process-specific configuration /// @throws std::bad_alloc in case of insufficient memory /* RULECHECKER_comment(0, 11, check_unique_ptr_construction, "monitorImplWrapperPtr uses unique pointer\ @@ -40,23 +40,23 @@ class Monitor { } - /// @brief The copy constructor for Monitor shall not be used. - Monitor(const Monitor& se) = delete; + /// @brief The copy constructor for Alive shall not be used. + Alive(const Alive& se) = delete; - /// @brief Move constructor for Monitor - /// @param [in,out] se The Monitor object to be moved - Monitor(Monitor&& se) noexcept : + /// @brief Move constructor for Alive + /// @param [in,out] se The Alive object to be moved + Alive(Alive&& se) noexcept : monitorImplWrapperPtr(std::move(se.monitorImplWrapperPtr)) { } - /// @brief The copy assignment operator for Monitor shall not be used. - Monitor& operator=(const Monitor& se) = delete; + /// @brief The copy assignment operator for Alive shall not be used. + Alive& operator=(const Alive& se) = delete; - /// @brief Move assignment operator for Monitor - /// @param [in,out] se The Monitor object to be moved - /// @return The moved Monitor object - Monitor& operator=(Monitor&& se) noexcept + /// @brief Move assignment operator for Alive + /// @param [in,out] se The Alive object to be moved + /// @return The moved Alive object + Alive& operator=(Alive&& se) noexcept { if (this != &se) { @@ -67,7 +67,7 @@ class Monitor return *this; } - /// @brief Destructor of a Monitor + /// @brief Destructor of an Alive virtual ~Monitor() noexcept { } @@ -117,4 +117,4 @@ extern "C" #endif } // namespace score::mw::lifecycle -#endif +#endif // SCORE_LCM_ALIVE_H_ diff --git a/score/launch_manager/daemon/src/alive_monitor/BUILD b/score/launch_manager/daemon/src/alive_monitor/BUILD index 1f208d17b..3407ac3f1 100644 --- a/score/launch_manager/daemon/src/alive_monitor/BUILD +++ b/score/launch_manager/daemon/src/alive_monitor/BUILD @@ -40,7 +40,7 @@ cc_library( cc_library( name = "alive_monitor_h", hdrs = [ - "Monitor.h", + "Alive.h", "MonitorImplWrapper.h", ], include_prefix = "score/mw/launch_manager/alive_monitor", @@ -51,11 +51,11 @@ cc_library( cc_library( name = "am-lib", srcs = [ - "Monitor.cpp", + "Alive.cpp", "MonitorImplWrapper.cpp", ], hdrs = [ - "Monitor.h", + "Alive.h", "MonitorImplWrapper.h", ], include_prefix = "score/mw/launch_manager/alive_monitor", @@ -81,7 +81,7 @@ cc_library( cc_library( name = "am_shared_lib", hdrs = [ - "Monitor.h", + "Alive.h", "MonitorImplWrapper.h", ], include_prefix = "score/mw/launch_manager/alive_monitor", diff --git a/score/launch_manager/daemon/src/alive_monitor/MonitorImplWrapper.cpp b/score/launch_manager/daemon/src/alive_monitor/MonitorImplWrapper.cpp index 59b4ba769..7c0e0cfe3 100644 --- a/score/launch_manager/daemon/src/alive_monitor/MonitorImplWrapper.cpp +++ b/score/launch_manager/daemon/src/alive_monitor/MonitorImplWrapper.cpp @@ -14,7 +14,7 @@ #include "score/mw/launch_manager/alive_monitor/MonitorImplWrapper.h" #include "score/mw/launch_manager/alive_monitor/details/MonitorImpl.h" -#include "score/mw/launch_manager/alive_monitor/Monitor.h" +#include "score/mw/launch_manager/alive_monitor/Alive.h" namespace score::mw::lifecycle { diff --git a/score/launch_manager/daemon/src/alive_monitor/details/MonitorImpl.h b/score/launch_manager/daemon/src/alive_monitor/details/MonitorImpl.h index 4f1f0ea84..74a946119 100644 --- a/score/launch_manager/daemon/src/alive_monitor/details/MonitorImpl.h +++ b/score/launch_manager/daemon/src/alive_monitor/details/MonitorImpl.h @@ -19,7 +19,7 @@ #include #include "score/mw/launch_manager/alive_monitor/MonitorImplWrapper.h" -#include "score/mw/launch_manager/alive_monitor/Monitor.h" +#include "score/mw/launch_manager/alive_monitor/Alive.h" #include "score/mw/launch_manager/alive_monitor/details/ifappl/DataStructures.hpp" #include "score/mw/launch_manager/alive_monitor/details/ipc/IpcClient.hpp" #include "score/mw/launch_manager/alive_monitor/details/logging/PhmLogger.hpp" From 19481b58ccd2e252d4b0d4e91407390b9ae3dc19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20Fu=C3=9Fberger?= Date: Fri, 5 Jun 2026 14:06:35 +0200 Subject: [PATCH 02/18] Make MonitorImplWrapper private --- .../daemon/src/alive_monitor/Alive.cpp | 45 ++++++++++++++- .../daemon/src/alive_monitor/Alive.h | 56 +++---------------- .../daemon/src/alive_monitor/BUILD | 6 +- .../daemon/src/alive_monitor/details/BUILD | 14 ++++- .../src/alive_monitor/details/MonitorImpl.cpp | 2 +- .../src/alive_monitor/details/MonitorImpl.h | 4 +- .../{ => details}/MonitorImplWrapper.cpp | 3 +- .../{ => details}/MonitorImplWrapper.h | 6 +- .../details/supervision/Alive.hpp | 1 - 9 files changed, 69 insertions(+), 68 deletions(-) rename score/launch_manager/daemon/src/alive_monitor/{ => details}/MonitorImplWrapper.cpp (91%) rename score/launch_manager/daemon/src/alive_monitor/{ => details}/MonitorImplWrapper.h (95%) diff --git a/score/launch_manager/daemon/src/alive_monitor/Alive.cpp b/score/launch_manager/daemon/src/alive_monitor/Alive.cpp index 84ee897c6..865d4b1bd 100644 --- a/score/launch_manager/daemon/src/alive_monitor/Alive.cpp +++ b/score/launch_manager/daemon/src/alive_monitor/Alive.cpp @@ -12,6 +12,45 @@ ********************************************************************************/ #include "score/mw/launch_manager/alive_monitor/Alive.h" +#include "score/mw/launch_manager/alive_monitor/details/MonitorImplWrapper.h" + +#include + +namespace score::mw::lifecycle +{ + +Alive::Alive(const std::string_view& instance) noexcept(false) : + monitorImplWrapperPtr(std::make_unique(instance)) +{ +} + +Alive::Alive(Alive&& se) noexcept : + monitorImplWrapperPtr(std::move(se.monitorImplWrapperPtr)) +{ +} + +Alive& Alive::operator=(Alive&& se) noexcept +{ + if (this != &se) + { + monitorImplWrapperPtr.reset(nullptr); + monitorImplWrapperPtr = std::move(se.monitorImplWrapperPtr); + } + + return *this; +} + +Alive::~Alive() noexcept = default; + +void Alive::ReportCheckpoint(std::uint32_t checkpointId) const noexcept +{ + if (monitorImplWrapperPtr.get() != nullptr) + { + monitorImplWrapperPtr->ReportCheckpoint(checkpointId); + } +} + +} // namespace score::mw::lifecycle enum class Dummy : std::uint32_t {}; @@ -21,7 +60,7 @@ extern "C" { void* score_lcm_monitor_initialize(const char* instanceSpecifier) noexcept { try { - auto* monitorPtr = new score::mw::lifecycle::Alive(instanceSpecifier); + auto* monitorPtr = new score::mw::lifecycle::Alive(instanceSpecifier); return static_cast(monitorPtr); } catch (...) { return nullptr; @@ -29,12 +68,12 @@ void* score_lcm_monitor_initialize(const char* instanceSpecifier) noexcept { } void score_lcm_monitor_deinitialize(void* instance) noexcept { - auto* monitorPtr = static_cast*>(instance); + auto* monitorPtr = static_cast(instance); delete monitorPtr; } void score_lcm_monitor_report_checkpoint(void* instance, std::uint32_t checkpointId) noexcept { - static_cast*>(instance)->ReportCheckpoint(static_cast(checkpointId)); + static_cast(instance)->ReportCheckpoint(checkpointId); } #ifdef __cplusplus diff --git a/score/launch_manager/daemon/src/alive_monitor/Alive.h b/score/launch_manager/daemon/src/alive_monitor/Alive.h index afca235bd..705af6d88 100644 --- a/score/launch_manager/daemon/src/alive_monitor/Alive.h +++ b/score/launch_manager/daemon/src/alive_monitor/Alive.h @@ -16,16 +16,15 @@ #include #include -#include -#include - -#include "score/mw/launch_manager/alive_monitor/MonitorImplWrapper.h" +#include namespace score::mw::lifecycle { +// Forward declaration +class MonitorImplWrapper; + /// @brief Alive Class -template class Alive { public: @@ -35,20 +34,14 @@ class Alive /// @throws std::bad_alloc in case of insufficient memory /* RULECHECKER_comment(0, 11, check_unique_ptr_construction, "monitorImplWrapperPtr uses unique pointer\ as type-casting to void pointer from make_unique is not possible", true_no_defect) */ - explicit Monitor(const std::string_view& instance) noexcept(false) : - monitorImplWrapperPtr(std::make_unique(instance)) - { - } + explicit Alive(const std::string_view& instance) noexcept(false); /// @brief The copy constructor for Alive shall not be used. Alive(const Alive& se) = delete; /// @brief Move constructor for Alive /// @param [in,out] se The Alive object to be moved - Alive(Alive&& se) noexcept : - monitorImplWrapperPtr(std::move(se.monitorImplWrapperPtr)) - { - } + Alive(Alive&& se) noexcept; /// @brief The copy assignment operator for Alive shall not be used. Alive& operator=(const Alive& se) = delete; @@ -56,21 +49,10 @@ class Alive /// @brief Move assignment operator for Alive /// @param [in,out] se The Alive object to be moved /// @return The moved Alive object - Alive& operator=(Alive&& se) noexcept - { - if (this != &se) - { - monitorImplWrapperPtr.reset(nullptr); - monitorImplWrapperPtr = std::move(se.monitorImplWrapperPtr); - } - - return *this; - } + Alive& operator=(Alive&& se) noexcept; /// @brief Destructor of an Alive - virtual ~Monitor() noexcept - { - } + virtual ~Alive() noexcept; /// @brief Reports an occurrence of a Checkpoint /// @param [in] checkpointId Checkpoint identifier. @@ -78,31 +60,11 @@ class Alive /// Report Checkpoint is NOT thread safe. /// In case a Monitor is shared between threads or in case two Monitor's are constructed /// with the same instance specifier in different threads a common lock before calling ReportCheckpoint is required. - void ReportCheckpoint(EnumT checkpointId) const noexcept - { - if (monitorImplWrapperPtr.get() != nullptr) - { - monitorImplWrapperPtr->ReportCheckpoint(static_cast(checkpointId)); - } - } + void ReportCheckpoint(std::uint32_t checkpointId) const noexcept; private: /// @brief Unique pointer to the wrapper of implementation class of Monitor std::unique_ptr monitorImplWrapperPtr; - - /// @brief Assert if Monitor class is constructed with an enumeration type - static_assert(std::is_enum::value, - "Monitor class must be constructed with template type " - "which is an enumeration class!"); - - /// @brief Underlying data type of the used template argument - using underlyingCheckpointIdType = typename std::underlying_type::type; - - /// @brief Assert if enumeration used during the construction of Monitor class - /// is of the type std::uint32_t - static_assert(std::is_same::value, - "The enumeration class used during the construction of Monitor class must be of " - "type 'std::uint32_t'!"); }; #ifdef __cplusplus diff --git a/score/launch_manager/daemon/src/alive_monitor/BUILD b/score/launch_manager/daemon/src/alive_monitor/BUILD index 3407ac3f1..da67d47df 100644 --- a/score/launch_manager/daemon/src/alive_monitor/BUILD +++ b/score/launch_manager/daemon/src/alive_monitor/BUILD @@ -41,7 +41,6 @@ cc_library( name = "alive_monitor_h", hdrs = [ "Alive.h", - "MonitorImplWrapper.h", ], include_prefix = "score/mw/launch_manager/alive_monitor", strip_include_prefix = "/score/launch_manager/daemon/src/alive_monitor", @@ -52,18 +51,16 @@ cc_library( name = "am-lib", srcs = [ "Alive.cpp", - "MonitorImplWrapper.cpp", ], hdrs = [ "Alive.h", - "MonitorImplWrapper.h", ], include_prefix = "score/mw/launch_manager/alive_monitor", strip_include_prefix = "/score/launch_manager/daemon/src/alive_monitor", visibility = ["//score:__subpackages__"], deps = [ ":alive_monitor_h", - "//score/launch_manager/daemon/src/alive_monitor/details:monitor_impl", + "//score/launch_manager/daemon/src/alive_monitor/details:monitor_impl_wrapper", ] + select({ "@platforms//os:qnx": [], "@platforms//os:linux": ["//externals/acl"], @@ -82,7 +79,6 @@ cc_library( name = "am_shared_lib", hdrs = [ "Alive.h", - "MonitorImplWrapper.h", ], include_prefix = "score/mw/launch_manager/alive_monitor", strip_include_prefix = "/score/launch_manager/daemon/src/alive_monitor", diff --git a/score/launch_manager/daemon/src/alive_monitor/details/BUILD b/score/launch_manager/daemon/src/alive_monitor/details/BUILD index 686d49b18..9a7d5dc2e 100644 --- a/score/launch_manager/daemon/src/alive_monitor/details/BUILD +++ b/score/launch_manager/daemon/src/alive_monitor/details/BUILD @@ -21,6 +21,19 @@ cc_test( ], ) +cc_library( + name = "monitor_impl_wrapper", + srcs = ["MonitorImplWrapper.cpp"], + hdrs = ["MonitorImplWrapper.h"], + include_prefix = "score/mw/launch_manager/alive_monitor/details", + strip_include_prefix = "/score/launch_manager/daemon/src/alive_monitor/details", + visibility = ["//score/launch_manager/daemon/src/alive_monitor:__subpackages__"], + deps = [ + ":monitor_impl" + ], +) + + cc_library( name = "monitor_impl", srcs = ["MonitorImpl.cpp"], @@ -29,7 +42,6 @@ cc_library( strip_include_prefix = "/score/launch_manager/daemon/src/alive_monitor/details", visibility = ["//score/launch_manager/daemon/src/alive_monitor:__subpackages__"], deps = [ - "//score/launch_manager/daemon/src/alive_monitor:alive_monitor_h", "//score/launch_manager/daemon/src/alive_monitor:config", "//score/launch_manager/daemon/src/alive_monitor/details/ifappl:data_structures", "//score/launch_manager/daemon/src/alive_monitor/details/ipc:ipc_if", diff --git a/score/launch_manager/daemon/src/alive_monitor/details/MonitorImpl.cpp b/score/launch_manager/daemon/src/alive_monitor/details/MonitorImpl.cpp index 5c666964b..b2e7cb302 100644 --- a/score/launch_manager/daemon/src/alive_monitor/details/MonitorImpl.cpp +++ b/score/launch_manager/daemon/src/alive_monitor/details/MonitorImpl.cpp @@ -33,7 +33,7 @@ MonitorImpl::MonitorImpl(const std::string_view& f_instanceSpecifier_r, connectToPhmDaemon(); } -void MonitorImpl::ReportCheckpoint(Checkpoint f_checkpointId) const noexcept(true) +void MonitorImpl::ReportCheckpoint(std::uint32_t f_checkpointId) const noexcept(true) { (void)ipcClient->sendEmplace(score::lcm::saf::timers::OsClock::getMonotonicSystemClock(), f_checkpointId); } diff --git a/score/launch_manager/daemon/src/alive_monitor/details/MonitorImpl.h b/score/launch_manager/daemon/src/alive_monitor/details/MonitorImpl.h index 74a946119..59a5f3634 100644 --- a/score/launch_manager/daemon/src/alive_monitor/details/MonitorImpl.h +++ b/score/launch_manager/daemon/src/alive_monitor/details/MonitorImpl.h @@ -18,8 +18,6 @@ #include #include -#include "score/mw/launch_manager/alive_monitor/MonitorImplWrapper.h" -#include "score/mw/launch_manager/alive_monitor/Alive.h" #include "score/mw/launch_manager/alive_monitor/details/ifappl/DataStructures.hpp" #include "score/mw/launch_manager/alive_monitor/details/ipc/IpcClient.hpp" #include "score/mw/launch_manager/alive_monitor/details/logging/PhmLogger.hpp" @@ -70,7 +68,7 @@ class MonitorImpl /// @brief Reports an occurrence of a Checkpoint /// @param [in] f_checkpointId Checkpoint identifier. - void ReportCheckpoint(Checkpoint f_checkpointId) const noexcept(true); + void ReportCheckpoint(std::uint32_t f_checkpointId) const noexcept(true); private: /// @brief Connect the application process with PHM daemon using IPC diff --git a/score/launch_manager/daemon/src/alive_monitor/MonitorImplWrapper.cpp b/score/launch_manager/daemon/src/alive_monitor/details/MonitorImplWrapper.cpp similarity index 91% rename from score/launch_manager/daemon/src/alive_monitor/MonitorImplWrapper.cpp rename to score/launch_manager/daemon/src/alive_monitor/details/MonitorImplWrapper.cpp index 7c0e0cfe3..f8ee2e5c6 100644 --- a/score/launch_manager/daemon/src/alive_monitor/MonitorImplWrapper.cpp +++ b/score/launch_manager/daemon/src/alive_monitor/details/MonitorImplWrapper.cpp @@ -11,10 +11,9 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -#include "score/mw/launch_manager/alive_monitor/MonitorImplWrapper.h" +#include "score/mw/launch_manager/alive_monitor/details/MonitorImplWrapper.h" #include "score/mw/launch_manager/alive_monitor/details/MonitorImpl.h" -#include "score/mw/launch_manager/alive_monitor/Alive.h" namespace score::mw::lifecycle { diff --git a/score/launch_manager/daemon/src/alive_monitor/MonitorImplWrapper.h b/score/launch_manager/daemon/src/alive_monitor/details/MonitorImplWrapper.h similarity index 95% rename from score/launch_manager/daemon/src/alive_monitor/MonitorImplWrapper.h rename to score/launch_manager/daemon/src/alive_monitor/details/MonitorImplWrapper.h index 95c92422d..078579182 100644 --- a/score/launch_manager/daemon/src/alive_monitor/MonitorImplWrapper.h +++ b/score/launch_manager/daemon/src/alive_monitor/details/MonitorImplWrapper.h @@ -20,10 +20,6 @@ namespace score::mw::lifecycle { - -/// @brief Represents a Checkpoint -using Checkpoint = std::uint32_t; - /// @brief Forward Declaration for them Implementation class for Monitor class MonitorImpl; @@ -67,7 +63,7 @@ class MonitorImplWrapper /// @brief Reports an occurrence of a Checkpoint /// @param [in] f_checkpointId Checkpoint identifier. - void ReportCheckpoint(score::mw::lifecycle::Checkpoint f_checkpointId) const noexcept(true); + void ReportCheckpoint(std::uint32_t f_checkpointId) const noexcept(true); private: /// @brief Unique pointer to the implementation class of Monitor diff --git a/score/launch_manager/daemon/src/alive_monitor/details/supervision/Alive.hpp b/score/launch_manager/daemon/src/alive_monitor/details/supervision/Alive.hpp index c46607da6..61ca5b82d 100644 --- a/score/launch_manager/daemon/src/alive_monitor/details/supervision/Alive.hpp +++ b/score/launch_manager/daemon/src/alive_monitor/details/supervision/Alive.hpp @@ -17,7 +17,6 @@ #include #include -#include "score/mw/launch_manager/alive_monitor/Monitor.h" #include "score/mw/launch_manager/alive_monitor/details/common/Observer.hpp" #include "score/mw/launch_manager/alive_monitor/details/common/TimeSortingBuffer.hpp" #include "score/mw/launch_manager/alive_monitor/details/ifappl/Checkpoint.hpp" From 6aa3aa2497067f855d54e2eca8a5c4505b781d40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20Fu=C3=9Fberger?= Date: Fri, 5 Jun 2026 14:16:39 +0200 Subject: [PATCH 03/18] Remove instanceSpecifier from Alive API --- score/launch_manager/daemon/src/alive_monitor/Alive.cpp | 8 ++++---- score/launch_manager/daemon/src/alive_monitor/Alive.h | 7 ++----- .../src/alive_monitor/details/MonitorImplWrapper.cpp | 2 +- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/score/launch_manager/daemon/src/alive_monitor/Alive.cpp b/score/launch_manager/daemon/src/alive_monitor/Alive.cpp index 865d4b1bd..7e2d2c384 100644 --- a/score/launch_manager/daemon/src/alive_monitor/Alive.cpp +++ b/score/launch_manager/daemon/src/alive_monitor/Alive.cpp @@ -19,8 +19,8 @@ namespace score::mw::lifecycle { -Alive::Alive(const std::string_view& instance) noexcept(false) : - monitorImplWrapperPtr(std::make_unique(instance)) +Alive::Alive() noexcept(false) : + monitorImplWrapperPtr(std::make_unique("default_instance")) { } @@ -58,9 +58,9 @@ enum class Dummy : std::uint32_t {}; extern "C" { #endif -void* score_lcm_monitor_initialize(const char* instanceSpecifier) noexcept { +void* score_lcm_monitor_initialize() noexcept { try { - auto* monitorPtr = new score::mw::lifecycle::Alive(instanceSpecifier); + auto* monitorPtr = new score::mw::lifecycle::Alive(); return static_cast(monitorPtr); } catch (...) { return nullptr; diff --git a/score/launch_manager/daemon/src/alive_monitor/Alive.h b/score/launch_manager/daemon/src/alive_monitor/Alive.h index 705af6d88..70b970225 100644 --- a/score/launch_manager/daemon/src/alive_monitor/Alive.h +++ b/score/launch_manager/daemon/src/alive_monitor/Alive.h @@ -29,12 +29,9 @@ class Alive { public: /// @brief Creation of an Alive. - /// @param [in] instance Instance specifier of the Alive /// @throws std::runtime_error in case of an error loading the process-specific configuration /// @throws std::bad_alloc in case of insufficient memory - /* RULECHECKER_comment(0, 11, check_unique_ptr_construction, "monitorImplWrapperPtr uses unique pointer\ - as type-casting to void pointer from make_unique is not possible", true_no_defect) */ - explicit Alive(const std::string_view& instance) noexcept(false); + Alive() noexcept(false); /// @brief The copy constructor for Alive shall not be used. Alive(const Alive& se) = delete; @@ -71,7 +68,7 @@ class Alive extern "C" { #endif - void* score_lcm_monitor_initialize(const char* instanceSpecifier) noexcept; + void* score_lcm_monitor_initialize() noexcept; void score_lcm_monitor_deinitialize(void* instance) noexcept; void score_lcm_monitor_report_checkpoint(void* instance, std::uint32_t checkpointId) noexcept; #ifdef __cplusplus diff --git a/score/launch_manager/daemon/src/alive_monitor/details/MonitorImplWrapper.cpp b/score/launch_manager/daemon/src/alive_monitor/details/MonitorImplWrapper.cpp index f8ee2e5c6..35b218307 100644 --- a/score/launch_manager/daemon/src/alive_monitor/details/MonitorImplWrapper.cpp +++ b/score/launch_manager/daemon/src/alive_monitor/details/MonitorImplWrapper.cpp @@ -30,7 +30,7 @@ MonitorImplWrapper::~MonitorImplWrapper() noexcept(true) monitorImplPtr.reset(); } -void MonitorImplWrapper::ReportCheckpoint(Checkpoint f_checkpointId) const noexcept(true) +void MonitorImplWrapper::ReportCheckpoint(std::uint32_t f_checkpointId) const noexcept(true) { if (monitorImplPtr.get() != nullptr) { From 49772b16f10ba8b5cabbcb94e1f3111070e5a300 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20Fu=C3=9Fberger?= Date: Fri, 5 Jun 2026 14:21:26 +0200 Subject: [PATCH 04/18] Remove obsolete MonitorImplWrapper class --- .../daemon/src/alive_monitor/Alive.cpp | 14 ++-- .../daemon/src/alive_monitor/Alive.h | 6 +- .../daemon/src/alive_monitor/BUILD | 2 +- .../daemon/src/alive_monitor/details/BUILD | 13 ---- .../details/MonitorImplWrapper.cpp | 41 ---------- .../details/MonitorImplWrapper.h | 75 ------------------- 6 files changed, 11 insertions(+), 140 deletions(-) delete mode 100644 score/launch_manager/daemon/src/alive_monitor/details/MonitorImplWrapper.cpp delete mode 100644 score/launch_manager/daemon/src/alive_monitor/details/MonitorImplWrapper.h diff --git a/score/launch_manager/daemon/src/alive_monitor/Alive.cpp b/score/launch_manager/daemon/src/alive_monitor/Alive.cpp index 7e2d2c384..bce4785fc 100644 --- a/score/launch_manager/daemon/src/alive_monitor/Alive.cpp +++ b/score/launch_manager/daemon/src/alive_monitor/Alive.cpp @@ -12,7 +12,7 @@ ********************************************************************************/ #include "score/mw/launch_manager/alive_monitor/Alive.h" -#include "score/mw/launch_manager/alive_monitor/details/MonitorImplWrapper.h" +#include "score/mw/launch_manager/alive_monitor/details/MonitorImpl.h" #include @@ -20,12 +20,12 @@ namespace score::mw::lifecycle { Alive::Alive() noexcept(false) : - monitorImplWrapperPtr(std::make_unique("default_instance")) + monitorImplPtr(std::make_unique("default_instance")) { } Alive::Alive(Alive&& se) noexcept : - monitorImplWrapperPtr(std::move(se.monitorImplWrapperPtr)) + monitorImplPtr(std::move(se.monitorImplPtr)) { } @@ -33,8 +33,8 @@ Alive& Alive::operator=(Alive&& se) noexcept { if (this != &se) { - monitorImplWrapperPtr.reset(nullptr); - monitorImplWrapperPtr = std::move(se.monitorImplWrapperPtr); + monitorImplPtr.reset(nullptr); + monitorImplPtr = std::move(se.monitorImplPtr); } return *this; @@ -44,9 +44,9 @@ Alive::~Alive() noexcept = default; void Alive::ReportCheckpoint(std::uint32_t checkpointId) const noexcept { - if (monitorImplWrapperPtr.get() != nullptr) + if (monitorImplPtr.get() != nullptr) { - monitorImplWrapperPtr->ReportCheckpoint(checkpointId); + monitorImplPtr->ReportCheckpoint(checkpointId); } } diff --git a/score/launch_manager/daemon/src/alive_monitor/Alive.h b/score/launch_manager/daemon/src/alive_monitor/Alive.h index 70b970225..451b3a53c 100644 --- a/score/launch_manager/daemon/src/alive_monitor/Alive.h +++ b/score/launch_manager/daemon/src/alive_monitor/Alive.h @@ -22,7 +22,7 @@ namespace score::mw::lifecycle { // Forward declaration -class MonitorImplWrapper; +class MonitorImpl; /// @brief Alive Class class Alive @@ -60,8 +60,8 @@ class Alive void ReportCheckpoint(std::uint32_t checkpointId) const noexcept; private: - /// @brief Unique pointer to the wrapper of implementation class of Monitor - std::unique_ptr monitorImplWrapperPtr; + /// @brief Unique pointer to implementation class of Monitor + std::unique_ptr monitorImplPtr; }; #ifdef __cplusplus diff --git a/score/launch_manager/daemon/src/alive_monitor/BUILD b/score/launch_manager/daemon/src/alive_monitor/BUILD index da67d47df..f1a1d1975 100644 --- a/score/launch_manager/daemon/src/alive_monitor/BUILD +++ b/score/launch_manager/daemon/src/alive_monitor/BUILD @@ -60,7 +60,7 @@ cc_library( visibility = ["//score:__subpackages__"], deps = [ ":alive_monitor_h", - "//score/launch_manager/daemon/src/alive_monitor/details:monitor_impl_wrapper", + "//score/launch_manager/daemon/src/alive_monitor/details:monitor_impl", ] + select({ "@platforms//os:qnx": [], "@platforms//os:linux": ["//externals/acl"], diff --git a/score/launch_manager/daemon/src/alive_monitor/details/BUILD b/score/launch_manager/daemon/src/alive_monitor/details/BUILD index 9a7d5dc2e..2858a846b 100644 --- a/score/launch_manager/daemon/src/alive_monitor/details/BUILD +++ b/score/launch_manager/daemon/src/alive_monitor/details/BUILD @@ -21,19 +21,6 @@ cc_test( ], ) -cc_library( - name = "monitor_impl_wrapper", - srcs = ["MonitorImplWrapper.cpp"], - hdrs = ["MonitorImplWrapper.h"], - include_prefix = "score/mw/launch_manager/alive_monitor/details", - strip_include_prefix = "/score/launch_manager/daemon/src/alive_monitor/details", - visibility = ["//score/launch_manager/daemon/src/alive_monitor:__subpackages__"], - deps = [ - ":monitor_impl" - ], -) - - cc_library( name = "monitor_impl", srcs = ["MonitorImpl.cpp"], diff --git a/score/launch_manager/daemon/src/alive_monitor/details/MonitorImplWrapper.cpp b/score/launch_manager/daemon/src/alive_monitor/details/MonitorImplWrapper.cpp deleted file mode 100644 index 35b218307..000000000 --- a/score/launch_manager/daemon/src/alive_monitor/details/MonitorImplWrapper.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2025 Contributors to the Eclipse Foundation - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * This program and the accompanying materials are made available under the - * terms of the Apache License Version 2.0 which is available at - * https://www.apache.org/licenses/LICENSE-2.0 - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ - -#include "score/mw/launch_manager/alive_monitor/details/MonitorImplWrapper.h" - -#include "score/mw/launch_manager/alive_monitor/details/MonitorImpl.h" - -namespace score::mw::lifecycle -{ - -MonitorImplWrapper::MonitorImplWrapper( - const std::string_view& f_instanceSpecifier_r) noexcept(false) : - // coverity[autosar_cpp14_a15_5_2_violation] This warning comes from pipc-sa(external library) - monitorImplPtr(std::make_unique(f_instanceSpecifier_r)) -{ -} - -MonitorImplWrapper::~MonitorImplWrapper() noexcept(true) -{ - monitorImplPtr.reset(); -} - -void MonitorImplWrapper::ReportCheckpoint(std::uint32_t f_checkpointId) const noexcept(true) -{ - if (monitorImplPtr.get() != nullptr) - { - monitorImplPtr->ReportCheckpoint(f_checkpointId); - } -} - -} // namespace score::mw::lifecycle diff --git a/score/launch_manager/daemon/src/alive_monitor/details/MonitorImplWrapper.h b/score/launch_manager/daemon/src/alive_monitor/details/MonitorImplWrapper.h deleted file mode 100644 index 078579182..000000000 --- a/score/launch_manager/daemon/src/alive_monitor/details/MonitorImplWrapper.h +++ /dev/null @@ -1,75 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2025 Contributors to the Eclipse Foundation - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * This program and the accompanying materials are made available under the - * terms of the Apache License Version 2.0 which is available at - * https://www.apache.org/licenses/LICENSE-2.0 - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ - -#ifndef SCORE_LCM_MonitorImplWrapper_H_ -#define SCORE_LCM_MonitorImplWrapper_H_ - -#include -#include -#include - -namespace score::mw::lifecycle -{ -/// @brief Forward Declaration for them Implementation class for Monitor -class MonitorImpl; - -/// @brief Wrapper of implementation class for score::mw::lifecycle::Monitor class -/// This class is just a wrapper and forwards the calls from score::mw::lifecycle::Monitor class -/// to the actual implementation class, i.e., score::mw::lifecycle::MonitorImpl -class MonitorImplWrapper -{ -public: - /// @brief Non-parametric constructor is not supported - MonitorImplWrapper() = delete; - - /// @brief Constructor of MonitorImplWrapper class - /// @param [in] f_instanceSpecifier_r Instance specifier object with the metamodel path of - /// the Monitor - /// @throws std::runtime_error in case of an error loading the process-specific configuration - /// @throws std::bad_alloc in case of insufficient memory - explicit MonitorImplWrapper(const std::string_view& f_instanceSpecifier_r) noexcept(false); - - /// @brief The copy constructor for MonitorImplWrapper is not supported. - MonitorImplWrapper(const MonitorImplWrapper&) = delete; - - /* RULECHECKER_comment(0, 6, check_incomplete_data_member_construction, "Default constructor is not provided\ - the member initializer", false) */ - /// @brief Default move constructor for MonitorImplWrapper - /// @param [in,out] MonitorImplWrapper&& rvalue reference of the MonitorImplWrapper object - /// which shall be moved - MonitorImplWrapper(MonitorImplWrapper&&) noexcept = default; - - /// @brief The copy assignment operator for MonitorImplWrapper is not supported. - MonitorImplWrapper& operator=(const MonitorImplWrapper&) & = delete; - - /// @brief Default move assignment operator for MonitorImplWrapper - /// @param [in,out] MonitorImplWrapper&& rvalue reference of the MonitorImplWrapper object - /// which shall be moved - /// @return Reference of the moved MonitorImplWrapper object - MonitorImplWrapper& operator=(MonitorImplWrapper&&) & noexcept = default; - - /// @brief Destructor of the class - virtual ~MonitorImplWrapper() noexcept(true); - - /// @brief Reports an occurrence of a Checkpoint - /// @param [in] f_checkpointId Checkpoint identifier. - void ReportCheckpoint(std::uint32_t f_checkpointId) const noexcept(true); - -private: - /// @brief Unique pointer to the implementation class of Monitor - std::unique_ptr monitorImplPtr; -}; - -} // namespace score::mw::lifecycle - -#endif From 8ff7a2c023f10c9dd17e92c9cae0dbcd8de4050e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20Fu=C3=9Fberger?= Date: Fri, 5 Jun 2026 14:39:36 +0200 Subject: [PATCH 05/18] Rename rust binding for Alive API --- Cargo.lock | 18 ++++++------- Cargo.toml | 2 +- examples/rust_supervised_app/Cargo.toml | 2 +- score/health_monitor/src/Cargo.toml | 4 +-- .../score_supervisor_api_client.rs | 6 ++--- score/launch_manager/BUILD | 2 +- .../daemon/src/alive_monitor/Alive.cpp | 18 ++++++------- .../daemon/src/alive_monitor/Alive.h | 9 ++++--- .../daemon/src/alive_monitor/rust/BUILD | 4 +-- .../daemon/src/alive_monitor/rust/Cargo.lock | 2 +- .../daemon/src/alive_monitor/rust/Cargo.toml | 4 +-- .../rust/src/{monitor.rs => alive.rs} | 26 +++++++------------ .../daemon/src/alive_monitor/rust/src/lib.rs | 4 +-- 13 files changed, 48 insertions(+), 53 deletions(-) rename score/launch_manager/daemon/src/alive_monitor/rust/src/{monitor.rs => alive.rs} (64%) diff --git a/Cargo.lock b/Cargo.lock index 5d7b04091..656cbc994 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -11,6 +11,13 @@ dependencies = [ "memchr", ] +[[package]] +name = "alive_rs" +version = "0.0.1" +dependencies = [ + "libc", +] + [[package]] name = "anstream" version = "1.0.0" @@ -163,9 +170,9 @@ dependencies = [ name = "health_monitoring_lib" version = "0.0.1" dependencies = [ + "alive_rs", "containers", "loom", - "monitor_rs", "score_log", "score_testing_macros", "stdout_logger", @@ -245,13 +252,6 @@ version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79" -[[package]] -name = "monitor_rs" -version = "0.0.1" -dependencies = [ - "libc", -] - [[package]] name = "nu-ansi-term" version = "0.50.3" @@ -328,11 +328,11 @@ checksum = "dc897dd8d9e8bd1ed8cdad82b5966c3e0ecae09fb1907d58efaa013543185d0a" name = "rust_supervised_app" version = "0.0.1" dependencies = [ + "alive_rs", "clap", "health_monitoring_lib", "libc", "lifecycle_client_rs", - "monitor_rs", "score_log", "signal-hook", "stdout_logger", diff --git a/Cargo.toml b/Cargo.toml index 471a26ae3..bb1149be8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,7 +19,7 @@ libc = "0.2.177" clap = { version = "4.5.49", features = ["derive"] } signal-hook = "0.3.18" -monitor_rs = { path = "score/launch_manager/daemon/src/alive_monitor/rust" } # Temporary API +alive_rs = { path = "score/launch_manager/daemon/src/alive_monitor/rust" } # Temporary API health_monitoring_lib = { path = "score/health_monitor/src" } score_log = { git = "https://github.com/eclipse-score/baselibs_rust.git", tag = "v0.1.1" } score_testing_macros = { git = "https://github.com/eclipse-score/baselibs_rust.git", tag = "v0.1.1" } diff --git a/examples/rust_supervised_app/Cargo.toml b/examples/rust_supervised_app/Cargo.toml index ff16e1b2b..f12bbf78e 100644 --- a/examples/rust_supervised_app/Cargo.toml +++ b/examples/rust_supervised_app/Cargo.toml @@ -12,7 +12,7 @@ clap = { workspace = true } libc = { workspace = true } signal-hook = { workspace = true } lifecycle_client_rs = { path = "../../score/launch_manager/lifecycle_client/src/rust" } -monitor_rs = { path = "../../score/launch_manager/daemon/src/alive_monitor/rust" } +alive_rs = { path = "../../score/launch_manager/daemon/src/alive_monitor/rust" } health_monitoring_lib.workspace = true score_log.workspace = true stdout_logger.workspace = true diff --git a/score/health_monitor/src/Cargo.toml b/score/health_monitor/src/Cargo.toml index 0c3ad00dd..afa397a9a 100644 --- a/score/health_monitor/src/Cargo.toml +++ b/score/health_monitor/src/Cargo.toml @@ -18,7 +18,7 @@ thread.workspace = true score_log.workspace = true score_testing_macros.workspace = true containers.workspace = true -monitor_rs = { workspace = true, optional = true } +alive_rs = { workspace = true, optional = true } [dev-dependencies] stdout_logger.workspace = true @@ -27,5 +27,5 @@ stdout_logger.workspace = true loom = { version = "0.7.2", features = ["checkpoint"] } [features] -default = ["monitor_rs"] +default = ["alive_rs"] stub_supervisor_api_client = [] diff --git a/score/health_monitor/src/rust/supervisor_api_client/score_supervisor_api_client.rs b/score/health_monitor/src/rust/supervisor_api_client/score_supervisor_api_client.rs index a198f9ada..a96fc06a6 100644 --- a/score/health_monitor/src/rust/supervisor_api_client/score_supervisor_api_client.rs +++ b/score/health_monitor/src/rust/supervisor_api_client/score_supervisor_api_client.rs @@ -18,7 +18,7 @@ use crate::supervisor_api_client::SupervisorAPIClient; use crate::worker::Checks; pub struct ScoreSupervisorAPIClient { - supervisor_link: monitor_rs::Monitor, + supervisor_link: alive_rs::Alive, } unsafe impl Send for ScoreSupervisorAPIClient {} // Just assuming it's safe to send across threads, this is a temporary solution @@ -28,13 +28,13 @@ impl ScoreSupervisorAPIClient { let value = std::env::var("IDENTIFIER").expect("IDENTIFIER env not set"); debug!("ScoreSupervisorAPIClient: Creating with IDENTIFIER={}", value); // This is only temporary usage so unwrap is fine here. - let supervisor_link = monitor_rs::Monitor::::new(&value).expect("Failed to create supervisor_link"); + let supervisor_link = alive_rs::Alive::new(&value).expect("Failed to create supervisor_link"); Self { supervisor_link } } } impl SupervisorAPIClient for ScoreSupervisorAPIClient { fn notify_alive(&self) { - self.supervisor_link.report_checkpoint(Checks::WorkerCheckpoint); + self.supervisor_link.report_checkpoint(Checks::WorkerCheckpoint as u32); } } diff --git a/score/launch_manager/BUILD b/score/launch_manager/BUILD index dde697b7c..8313bcfb2 100644 --- a/score/launch_manager/BUILD +++ b/score/launch_manager/BUILD @@ -26,7 +26,7 @@ alias( alias( name = "alive_rust", - actual = "//score/launch_manager/daemon/src/alive_monitor/rust:monitor_rs", + actual = "//score/launch_manager/daemon/src/alive_monitor/rust:alive_rs", ) alias( diff --git a/score/launch_manager/daemon/src/alive_monitor/Alive.cpp b/score/launch_manager/daemon/src/alive_monitor/Alive.cpp index bce4785fc..f49f73096 100644 --- a/score/launch_manager/daemon/src/alive_monitor/Alive.cpp +++ b/score/launch_manager/daemon/src/alive_monitor/Alive.cpp @@ -19,8 +19,8 @@ namespace score::mw::lifecycle { -Alive::Alive() noexcept(false) : - monitorImplPtr(std::make_unique("default_instance")) +Alive::Alive(const std::string_view& instance) noexcept(false) : + monitorImplPtr(std::make_unique("instance")) { } @@ -58,21 +58,21 @@ enum class Dummy : std::uint32_t {}; extern "C" { #endif -void* score_lcm_monitor_initialize() noexcept { +void* score_lcm_alive_initialize(const char* instanceSpecifier) noexcept { try { - auto* monitorPtr = new score::mw::lifecycle::Alive(); - return static_cast(monitorPtr); + auto* alivePtr = new score::mw::lifecycle::Alive(instanceSpecifier); + return static_cast(alivePtr); } catch (...) { return nullptr; } } -void score_lcm_monitor_deinitialize(void* instance) noexcept { - auto* monitorPtr = static_cast(instance); - delete monitorPtr; +void score_lcm_alive_deinitialize(void* instance) noexcept { + auto* alivePtr = static_cast(instance); + delete alivePtr; } -void score_lcm_monitor_report_checkpoint(void* instance, std::uint32_t checkpointId) noexcept { +void score_lcm_alive_report_checkpoint(void* instance, std::uint32_t checkpointId) noexcept { static_cast(instance)->ReportCheckpoint(checkpointId); } diff --git a/score/launch_manager/daemon/src/alive_monitor/Alive.h b/score/launch_manager/daemon/src/alive_monitor/Alive.h index 451b3a53c..fb3c60c86 100644 --- a/score/launch_manager/daemon/src/alive_monitor/Alive.h +++ b/score/launch_manager/daemon/src/alive_monitor/Alive.h @@ -29,9 +29,10 @@ class Alive { public: /// @brief Creation of an Alive. + /// @param [in] instance Instance specifier of the Monitor /// @throws std::runtime_error in case of an error loading the process-specific configuration /// @throws std::bad_alloc in case of insufficient memory - Alive() noexcept(false); + explicit Alive(const std::string_view& instance) noexcept(false); /// @brief The copy constructor for Alive shall not be used. Alive(const Alive& se) = delete; @@ -68,9 +69,9 @@ class Alive extern "C" { #endif - void* score_lcm_monitor_initialize() noexcept; - void score_lcm_monitor_deinitialize(void* instance) noexcept; - void score_lcm_monitor_report_checkpoint(void* instance, std::uint32_t checkpointId) noexcept; + void* score_lcm_alive_initialize(const char* instanceSpecifier) noexcept; + void score_lcm_alive_deinitialize(void* instance) noexcept; + void score_lcm_alive_report_checkpoint(void* instance, std::uint32_t checkpointId) noexcept; #ifdef __cplusplus } #endif diff --git a/score/launch_manager/daemon/src/alive_monitor/rust/BUILD b/score/launch_manager/daemon/src/alive_monitor/rust/BUILD index 7a01584ae..9e2c97dcd 100644 --- a/score/launch_manager/daemon/src/alive_monitor/rust/BUILD +++ b/score/launch_manager/daemon/src/alive_monitor/rust/BUILD @@ -13,11 +13,11 @@ load("@rules_rust//rust:defs.bzl", "rust_library") rust_library( - name = "monitor_rs", + name = "alive_rs", srcs = [ "src/errors.rs", "src/lib.rs", - "src/monitor.rs", + "src/alive.rs", ], visibility = ["//score:__subpackages__"], deps = [ diff --git a/score/launch_manager/daemon/src/alive_monitor/rust/Cargo.lock b/score/launch_manager/daemon/src/alive_monitor/rust/Cargo.lock index f55059e7c..1d78b7626 100644 --- a/score/launch_manager/daemon/src/alive_monitor/rust/Cargo.lock +++ b/score/launch_manager/daemon/src/alive_monitor/rust/Cargo.lock @@ -9,7 +9,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2874a2af47a2325c2001a6e6fad9b16a53b802102b528163885171cf92b15976" [[package]] -name = "monitor_rs" +name = "alive_rs" version = "0.0.1" dependencies = [ "libc", diff --git a/score/launch_manager/daemon/src/alive_monitor/rust/Cargo.toml b/score/launch_manager/daemon/src/alive_monitor/rust/Cargo.toml index d6bfb444a..5a222760c 100644 --- a/score/launch_manager/daemon/src/alive_monitor/rust/Cargo.toml +++ b/score/launch_manager/daemon/src/alive_monitor/rust/Cargo.toml @@ -1,10 +1,10 @@ [package] -name = "monitor_rs" +name = "alive_rs" version = "0.0.1" edition = "2021" [lib] -name = "monitor_rs" +name = "alive_rs" crate-type = ["cdylib", "rlib"] [dependencies] diff --git a/score/launch_manager/daemon/src/alive_monitor/rust/src/monitor.rs b/score/launch_manager/daemon/src/alive_monitor/rust/src/alive.rs similarity index 64% rename from score/launch_manager/daemon/src/alive_monitor/rust/src/monitor.rs rename to score/launch_manager/daemon/src/alive_monitor/rust/src/alive.rs index ea6e28998..9a4868d79 100644 --- a/score/launch_manager/daemon/src/alive_monitor/rust/src/monitor.rs +++ b/score/launch_manager/daemon/src/alive_monitor/rust/src/alive.rs @@ -13,33 +13,30 @@ use crate::errors; use libc::{c_char, c_uint, c_void}; use std::ffi::CString; -use std::marker::PhantomData; #[link(name = "lifecycle_client")] unsafe extern "C" { - fn score_lcm_monitor_initialize(instanceSpecifier: *const c_char) -> *mut c_void; - fn score_lcm_monitor_deinitialize(instance: *mut c_void); - fn score_lcm_monitor_report_checkpoint(instance: *mut c_void, checkpoint_id: c_uint); + fn score_lcm_alive_initialize(instanceSpecifier: *const c_char) -> *mut c_void; + fn score_lcm_alive_deinitialize(instance: *mut c_void); + fn score_lcm_alive_report_checkpoint(instance: *mut c_void, checkpoint_id: c_uint); } -pub struct Monitor { +pub struct Alive { instance_ptr: *mut c_void, name: CString, - phantom: PhantomData, } -impl Monitor { +impl Alive { pub fn new(instance: &str) -> Result> { let tmp_str = CString::new(instance)?; let mut tmp_inst = Self { instance_ptr: std::ptr::null_mut(), name: tmp_str, - phantom: PhantomData, }; let ptr: *mut c_void; unsafe { - ptr = score_lcm_monitor_initialize(tmp_inst.name.as_ptr()); + ptr = score_lcm_alive_initialize(tmp_inst.name.as_ptr()); } if ptr.is_null() { @@ -50,21 +47,18 @@ impl Monitor { Ok(tmp_inst) } - pub fn report_checkpoint(&self, checkpoint_id: EnumT) - where - EnumT: Into + Copy, - { + pub fn report_checkpoint(&self, checkpoint_id: u32) { let id: u32 = checkpoint_id.into(); unsafe { - score_lcm_monitor_report_checkpoint(self.instance_ptr, id); + score_lcm_alive_report_checkpoint(self.instance_ptr, id); } } } -impl Drop for Monitor { +impl Drop for Alive { fn drop(&mut self) { unsafe { - score_lcm_monitor_deinitialize(self.instance_ptr); + score_lcm_alive_deinitialize(self.instance_ptr); } } } diff --git a/score/launch_manager/daemon/src/alive_monitor/rust/src/lib.rs b/score/launch_manager/daemon/src/alive_monitor/rust/src/lib.rs index fe010c738..bbfd220c6 100644 --- a/score/launch_manager/daemon/src/alive_monitor/rust/src/lib.rs +++ b/score/launch_manager/daemon/src/alive_monitor/rust/src/lib.rs @@ -10,8 +10,8 @@ // // SPDX-License-Identifier: Apache-2.0 // ******************************************************************************* +pub mod alive; pub mod errors; -pub mod monitor; +pub use alive::Alive; pub use errors::ConstructorError; -pub use monitor::Monitor; From ab0ce3d3cdc617c1da1e4cdb84d3907f32e6d0d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20Fu=C3=9Fberger?= Date: Fri, 5 Jun 2026 14:45:42 +0200 Subject: [PATCH 06/18] Further renaming --- .../daemon/src/alive_monitor/Alive.cpp | 14 ++++----- .../daemon/src/alive_monitor/Alive.h | 6 ++-- .../daemon/src/alive_monitor/BUILD | 4 +-- .../{MonitorImpl.cpp => AliveImpl.cpp} | 10 +++---- .../details/{MonitorImpl.h => AliveImpl.h} | 30 +++++++++---------- .../{MonitorImpl_UT.cpp => AliveImpl_UT.cpp} | 20 ++++++------- .../daemon/src/alive_monitor/details/BUILD | 12 ++++---- .../src/alive_monitor/details/daemon/BUILD | 2 +- 8 files changed, 49 insertions(+), 49 deletions(-) rename score/launch_manager/daemon/src/alive_monitor/details/{MonitorImpl.cpp => AliveImpl.cpp} (87%) rename score/launch_manager/daemon/src/alive_monitor/details/{MonitorImpl.h => AliveImpl.h} (82%) rename score/launch_manager/daemon/src/alive_monitor/details/{MonitorImpl_UT.cpp => AliveImpl_UT.cpp} (66%) diff --git a/score/launch_manager/daemon/src/alive_monitor/Alive.cpp b/score/launch_manager/daemon/src/alive_monitor/Alive.cpp index f49f73096..0d7954c17 100644 --- a/score/launch_manager/daemon/src/alive_monitor/Alive.cpp +++ b/score/launch_manager/daemon/src/alive_monitor/Alive.cpp @@ -12,7 +12,7 @@ ********************************************************************************/ #include "score/mw/launch_manager/alive_monitor/Alive.h" -#include "score/mw/launch_manager/alive_monitor/details/MonitorImpl.h" +#include "score/mw/launch_manager/alive_monitor/details/AliveImpl.h" #include @@ -20,12 +20,12 @@ namespace score::mw::lifecycle { Alive::Alive(const std::string_view& instance) noexcept(false) : - monitorImplPtr(std::make_unique("instance")) + aliveImplPtr(std::make_unique(instance)) { } Alive::Alive(Alive&& se) noexcept : - monitorImplPtr(std::move(se.monitorImplPtr)) + aliveImplPtr(std::move(se.aliveImplPtr)) { } @@ -33,8 +33,8 @@ Alive& Alive::operator=(Alive&& se) noexcept { if (this != &se) { - monitorImplPtr.reset(nullptr); - monitorImplPtr = std::move(se.monitorImplPtr); + aliveImplPtr.reset(nullptr); + aliveImplPtr = std::move(se.aliveImplPtr); } return *this; @@ -44,9 +44,9 @@ Alive::~Alive() noexcept = default; void Alive::ReportCheckpoint(std::uint32_t checkpointId) const noexcept { - if (monitorImplPtr.get() != nullptr) + if (aliveImplPtr.get() != nullptr) { - monitorImplPtr->ReportCheckpoint(checkpointId); + aliveImplPtr->ReportCheckpoint(checkpointId); } } diff --git a/score/launch_manager/daemon/src/alive_monitor/Alive.h b/score/launch_manager/daemon/src/alive_monitor/Alive.h index fb3c60c86..18819f470 100644 --- a/score/launch_manager/daemon/src/alive_monitor/Alive.h +++ b/score/launch_manager/daemon/src/alive_monitor/Alive.h @@ -22,7 +22,7 @@ namespace score::mw::lifecycle { // Forward declaration -class MonitorImpl; +class AliveImpl; /// @brief Alive Class class Alive @@ -61,8 +61,8 @@ class Alive void ReportCheckpoint(std::uint32_t checkpointId) const noexcept; private: - /// @brief Unique pointer to implementation class of Monitor - std::unique_ptr monitorImplPtr; + /// @brief Unique pointer to implementation class of Alive + std::unique_ptr aliveImplPtr; }; #ifdef __cplusplus diff --git a/score/launch_manager/daemon/src/alive_monitor/BUILD b/score/launch_manager/daemon/src/alive_monitor/BUILD index f1a1d1975..e87027b6e 100644 --- a/score/launch_manager/daemon/src/alive_monitor/BUILD +++ b/score/launch_manager/daemon/src/alive_monitor/BUILD @@ -60,7 +60,7 @@ cc_library( visibility = ["//score:__subpackages__"], deps = [ ":alive_monitor_h", - "//score/launch_manager/daemon/src/alive_monitor/details:monitor_impl", + "//score/launch_manager/daemon/src/alive_monitor/details:alive_impl", ] + select({ "@platforms//os:qnx": [], "@platforms//os:linux": ["//externals/acl"], @@ -71,7 +71,7 @@ cc_library( name = "alive_monitor", visibility = ["//score:__subpackages__"], deps = [ - "//score/launch_manager/daemon/src/alive_monitor/details/daemon:health_monitor_impl", + "//score/launch_manager/daemon/src/alive_monitor/details/daemon:alive_monitor_impl", ], ) diff --git a/score/launch_manager/daemon/src/alive_monitor/details/MonitorImpl.cpp b/score/launch_manager/daemon/src/alive_monitor/details/AliveImpl.cpp similarity index 87% rename from score/launch_manager/daemon/src/alive_monitor/details/MonitorImpl.cpp rename to score/launch_manager/daemon/src/alive_monitor/details/AliveImpl.cpp index b2e7cb302..ea7cb6f94 100644 --- a/score/launch_manager/daemon/src/alive_monitor/details/MonitorImpl.cpp +++ b/score/launch_manager/daemon/src/alive_monitor/details/AliveImpl.cpp @@ -11,7 +11,7 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -#include "score/mw/launch_manager/alive_monitor/details/MonitorImpl.h" +#include "score/mw/launch_manager/alive_monitor/details/AliveImpl.h" #include @@ -22,7 +22,7 @@ namespace score::mw::lifecycle { -MonitorImpl::MonitorImpl(const std::string_view& f_instanceSpecifier_r, +AliveImpl::AliveImpl(const std::string_view& f_instanceSpecifier_r, std::unique_ptr f_ipcClient) noexcept(false) : k_instanceSpecifierPath(f_instanceSpecifier_r), ipcClient(std::move(f_ipcClient)), @@ -33,12 +33,12 @@ MonitorImpl::MonitorImpl(const std::string_view& f_instanceSpecifier_r, connectToPhmDaemon(); } -void MonitorImpl::ReportCheckpoint(std::uint32_t f_checkpointId) const noexcept(true) +void AliveImpl::ReportCheckpoint(std::uint32_t f_checkpointId) const noexcept(true) { (void)ipcClient->sendEmplace(score::lcm::saf::timers::OsClock::getMonotonicSystemClock(), f_checkpointId); } -void MonitorImpl::connectToPhmDaemon(void) noexcept(false) +void AliveImpl::connectToPhmDaemon(void) noexcept(false) { const auto ipc_path_res = readInterfacePath(); if (ipc_path_res == std::nullopt) @@ -61,7 +61,7 @@ void MonitorImpl::connectToPhmDaemon(void) noexcept(false) logger_r.LogError() << "Connection to PHM daemon failed, for the Monitor (" << k_instanceSpecifierPath << ")"; } -std::optional MonitorImpl::readInterfacePath() noexcept +std::optional AliveImpl::readInterfacePath() noexcept { const char* if_path{getenv("LCM_ALIVE_INTERFACE_PATH")}; if (if_path == nullptr || if_path[0] == '\0') diff --git a/score/launch_manager/daemon/src/alive_monitor/details/MonitorImpl.h b/score/launch_manager/daemon/src/alive_monitor/details/AliveImpl.h similarity index 82% rename from score/launch_manager/daemon/src/alive_monitor/details/MonitorImpl.h rename to score/launch_manager/daemon/src/alive_monitor/details/AliveImpl.h index 59a5f3634..4f5e1125d 100644 --- a/score/launch_manager/daemon/src/alive_monitor/details/MonitorImpl.h +++ b/score/launch_manager/daemon/src/alive_monitor/details/AliveImpl.h @@ -11,8 +11,8 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -#ifndef SCORE_LCM_MonitorImpl_H_ -#define SCORE_LCM_MonitorImpl_H_ +#ifndef SCORE_LCM_AliveImpl_H_ +#define SCORE_LCM_AliveImpl_H_ #include #include @@ -29,7 +29,7 @@ namespace score::mw::lifecycle /// This class is responsible for establishing the connection between the application and PHM daemon /// by invoking the calls to PHM class methods and to forward the reported checkpoints from the application /// to PHM daemon for supervision evaluation -class MonitorImpl +class AliveImpl { public: /// @brief The element that is sent via IPC @@ -39,32 +39,32 @@ class MonitorImpl score::lcm::saf::ifappl::k_maxCheckpointBufferElements>; /// @brief Non-parametric constructor is not supported - MonitorImpl() = delete; + AliveImpl() = delete; - /// @brief Constructor of MonitorImpl class + /// @brief Constructor of AliveImpl class /// @param [in] f_instanceSpecifier_r Instance specifier object with the metamodel path of /// the Monitor /// @param [in] f_ipcClient Ipc Connection to PHM daemon /// @throws std::runtime_error in case ipc path could not be read from configuration /// @throws std::bad_alloc in case of insufficient memory - explicit MonitorImpl( + explicit AliveImpl( const std::string_view& f_instanceSpecifier_r, std::unique_ptr f_ipcClient = std::make_unique()) noexcept(false); - /// @brief The copy constructor for MonitorImpl is not supported. - MonitorImpl(const MonitorImpl&) = delete; + /// @brief The copy constructor for AliveImpl is not supported. + AliveImpl(const AliveImpl&) = delete; - /// @brief The move constructor for MonitorImpl is not supported. - MonitorImpl(MonitorImpl&&) = delete; + /// @brief The move constructor for AliveImpl is not supported. + AliveImpl(AliveImpl&&) = delete; - /// @brief The copy assignment operator for MonitorImpl is not supported. - MonitorImpl& operator=(const MonitorImpl&) & = delete; + /// @brief The copy assignment operator for AliveImpl is not supported. + AliveImpl& operator=(const AliveImpl&) & = delete; - /// @brief The move assignment operator for MonitorImpl is not supported. - MonitorImpl& operator=(MonitorImpl&&) & noexcept = delete; + /// @brief The move assignment operator for AliveImpl is not supported. + AliveImpl& operator=(AliveImpl&&) & noexcept = delete; /// @brief Destructor of the class - virtual ~MonitorImpl() = default; + virtual ~AliveImpl() = default; /// @brief Reports an occurrence of a Checkpoint /// @param [in] f_checkpointId Checkpoint identifier. diff --git a/score/launch_manager/daemon/src/alive_monitor/details/MonitorImpl_UT.cpp b/score/launch_manager/daemon/src/alive_monitor/details/AliveImpl_UT.cpp similarity index 66% rename from score/launch_manager/daemon/src/alive_monitor/details/MonitorImpl_UT.cpp rename to score/launch_manager/daemon/src/alive_monitor/details/AliveImpl_UT.cpp index 013fa4fe5..7bd86bacb 100644 --- a/score/launch_manager/daemon/src/alive_monitor/details/MonitorImpl_UT.cpp +++ b/score/launch_manager/daemon/src/alive_monitor/details/AliveImpl_UT.cpp @@ -14,12 +14,12 @@ #include -#include "score/mw/launch_manager/alive_monitor/details/MonitorImpl.h" +#include "score/mw/launch_manager/alive_monitor/details/AliveImpl.h" namespace score::mw::lifecycle { -class MonitorImplTest : public ::testing::Test +class AliveImplTest : public ::testing::Test { protected: void SetUp() override @@ -30,29 +30,29 @@ class MonitorImplTest : public ::testing::Test } }; -TEST_F(MonitorImplTest, ThrowsWhenInterfacePathEnvVarIsNotSet) +TEST_F(AliveImplTest, ThrowsWhenInterfacePathEnvVarIsNotSet) { - RecordProperty("Description", "MonitorImpl throws when LCM_ALIVE_INTERFACE_PATH is not set."); + RecordProperty("Description", "AliveImpl throws when LCM_ALIVE_INTERFACE_PATH is not set."); - EXPECT_THROW(MonitorImpl("test/instance"), std::runtime_error); + EXPECT_THROW(AliveImpl("test/instance"), std::runtime_error); } -TEST_F(MonitorImplTest, DoesNotThrowWhenInterfacePathEnvVarIsSet) +TEST_F(AliveImplTest, DoesNotThrowWhenInterfacePathEnvVarIsSet) { RecordProperty("Description", - "MonitorImpl construction succeeds when LCM_ALIVE_INTERFACE_PATH is set, " + "AliveImpl construction succeeds when LCM_ALIVE_INTERFACE_PATH is set, " "even if the IPC path does not exist."); setenv("LCM_ALIVE_INTERFACE_PATH", "nonexistent_ipc_path", 1); - EXPECT_NO_THROW({ MonitorImpl impl("test/instance"); }); + EXPECT_NO_THROW({ AliveImpl impl("test/instance"); }); } -TEST_F(MonitorImplTest, ReportCheckpointSafeWhenNotConnected) +TEST_F(AliveImplTest, ReportCheckpointSafeWhenNotConnected) { RecordProperty("Description", "ReportCheckpoint does not crash when the IPC connection was not established."); setenv("LCM_ALIVE_INTERFACE_PATH", "nonexistent_ipc_path", 1); - MonitorImpl impl("test/instance"); + AliveImpl impl("test/instance"); EXPECT_NO_THROW(impl.ReportCheckpoint(42U)); } diff --git a/score/launch_manager/daemon/src/alive_monitor/details/BUILD b/score/launch_manager/daemon/src/alive_monitor/details/BUILD index 2858a846b..9eda3bd8e 100644 --- a/score/launch_manager/daemon/src/alive_monitor/details/BUILD +++ b/score/launch_manager/daemon/src/alive_monitor/details/BUILD @@ -13,18 +13,18 @@ load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test") cc_test( - name = "MonitorImpl_UT", - srcs = ["MonitorImpl_UT.cpp"], + name = "AliveImpl_UT", + srcs = ["AliveImpl_UT.cpp"], deps = [ - ":monitor_impl", + ":alive_impl", "@googletest//:gtest_main", ], ) cc_library( - name = "monitor_impl", - srcs = ["MonitorImpl.cpp"], - hdrs = ["MonitorImpl.h"], + name = "alive_impl", + srcs = ["AliveImpl.cpp"], + hdrs = ["AliveImpl.h"], include_prefix = "score/mw/launch_manager/alive_monitor/details", strip_include_prefix = "/score/launch_manager/daemon/src/alive_monitor/details", visibility = ["//score/launch_manager/daemon/src/alive_monitor:__subpackages__"], diff --git a/score/launch_manager/daemon/src/alive_monitor/details/daemon/BUILD b/score/launch_manager/daemon/src/alive_monitor/details/daemon/BUILD index 5b767374c..b230acfd8 100644 --- a/score/launch_manager/daemon/src/alive_monitor/details/daemon/BUILD +++ b/score/launch_manager/daemon/src/alive_monitor/details/daemon/BUILD @@ -76,7 +76,7 @@ cc_library( ) cc_library( - name = "health_monitor_impl", + name = "alive_monitor_impl", srcs = ["AliveMonitorImpl.cpp"], hdrs = ["AliveMonitorImpl.hpp"], include_prefix = "score/mw/launch_manager/alive_monitor/details/daemon", From 8a7be450f854b959d804ebbc14a26daf744c70f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20Fu=C3=9Fberger?= Date: Fri, 5 Jun 2026 15:37:53 +0200 Subject: [PATCH 07/18] Move Alive API to launch_manager/alive --- Cargo.toml | 2 +- examples/cpp_supervised_app/BUILD | 1 - examples/rust_supervised_app/Cargo.toml | 2 +- score/launch_manager/BUILD | 4 +- score/launch_manager/alive/BUILD | 29 ++++++++++++ .../Alive.cpp => alive/src/alive.cpp} | 2 +- .../Alive.h => alive/src/alive.h} | 0 .../src}/details/AliveImpl.cpp | 0 .../src}/details/AliveImpl.h | 0 .../src}/details/AliveImpl_UT.cpp | 0 .../alive_monitor => alive/src}/details/BUILD | 9 ++-- .../alive_monitor => alive/src}/rust/BUILD | 0 .../src}/rust/Cargo.lock | 0 .../src}/rust/Cargo.toml | 0 .../src}/rust/src/alive.rs | 0 .../src}/rust/src/errors.rs | 0 .../src}/rust/src/lib.rs | 0 .../daemon/src/alive_monitor/BUILD | 47 ------------------- .../src/alive_monitor/details/daemon/BUILD | 4 +- .../src/alive_monitor/details/factory/BUILD | 10 +--- .../src/alive_monitor/details/ifappl/BUILD | 5 +- .../src/alive_monitor/details/ipc/BUILD | 5 +- .../src/alive_monitor/details/logging/BUILD | 5 +- .../alive_monitor/details/supervision/BUILD | 1 - .../src/alive_monitor/details/timers/BUILD | 5 +- 25 files changed, 58 insertions(+), 73 deletions(-) create mode 100644 score/launch_manager/alive/BUILD rename score/launch_manager/{daemon/src/alive_monitor/Alive.cpp => alive/src/alive.cpp} (97%) rename score/launch_manager/{daemon/src/alive_monitor/Alive.h => alive/src/alive.h} (100%) rename score/launch_manager/{daemon/src/alive_monitor => alive/src}/details/AliveImpl.cpp (100%) rename score/launch_manager/{daemon/src/alive_monitor => alive/src}/details/AliveImpl.h (100%) rename score/launch_manager/{daemon/src/alive_monitor => alive/src}/details/AliveImpl_UT.cpp (100%) rename score/launch_manager/{daemon/src/alive_monitor => alive/src}/details/BUILD (77%) rename score/launch_manager/{daemon/src/alive_monitor => alive/src}/rust/BUILD (100%) rename score/launch_manager/{daemon/src/alive_monitor => alive/src}/rust/Cargo.lock (100%) rename score/launch_manager/{daemon/src/alive_monitor => alive/src}/rust/Cargo.toml (100%) rename score/launch_manager/{daemon/src/alive_monitor => alive/src}/rust/src/alive.rs (100%) rename score/launch_manager/{daemon/src/alive_monitor => alive/src}/rust/src/errors.rs (100%) rename score/launch_manager/{daemon/src/alive_monitor => alive/src}/rust/src/lib.rs (100%) diff --git a/Cargo.toml b/Cargo.toml index bb1149be8..26372622f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,7 +19,7 @@ libc = "0.2.177" clap = { version = "4.5.49", features = ["derive"] } signal-hook = "0.3.18" -alive_rs = { path = "score/launch_manager/daemon/src/alive_monitor/rust" } # Temporary API +alive_rs = { path = "score/launch_manager/alive/src/rust" } # Temporary API health_monitoring_lib = { path = "score/health_monitor/src" } score_log = { git = "https://github.com/eclipse-score/baselibs_rust.git", tag = "v0.1.1" } score_testing_macros = { git = "https://github.com/eclipse-score/baselibs_rust.git", tag = "v0.1.1" } diff --git a/examples/cpp_supervised_app/BUILD b/examples/cpp_supervised_app/BUILD index 0c09a7276..379938ed7 100644 --- a/examples/cpp_supervised_app/BUILD +++ b/examples/cpp_supervised_app/BUILD @@ -33,7 +33,6 @@ cc_binary( visibility = ["//visibility:public"], deps = [ "//score/health_monitor:health_monitoring_cc", - "//score/launch_manager:alive_cc", "//score/launch_manager:lifecycle_cc", "@score_baselibs_rust//src/log/stdout_logger_cpp_init", ], diff --git a/examples/rust_supervised_app/Cargo.toml b/examples/rust_supervised_app/Cargo.toml index f12bbf78e..9c2d2d94a 100644 --- a/examples/rust_supervised_app/Cargo.toml +++ b/examples/rust_supervised_app/Cargo.toml @@ -12,7 +12,7 @@ clap = { workspace = true } libc = { workspace = true } signal-hook = { workspace = true } lifecycle_client_rs = { path = "../../score/launch_manager/lifecycle_client/src/rust" } -alive_rs = { path = "../../score/launch_manager/daemon/src/alive_monitor/rust" } +alive_rs = { path = "../../score/launch_manager/alive/src/rust" } health_monitoring_lib.workspace = true score_log.workspace = true stdout_logger.workspace = true diff --git a/score/launch_manager/BUILD b/score/launch_manager/BUILD index 8313bcfb2..7778ac13a 100644 --- a/score/launch_manager/BUILD +++ b/score/launch_manager/BUILD @@ -21,12 +21,12 @@ alias( alias( name = "alive_cc", - actual = "//score/launch_manager/daemon/src/alive_monitor:am_shared_lib", + actual = "//score/launch_manager/alive:alive", ) alias( name = "alive_rust", - actual = "//score/launch_manager/daemon/src/alive_monitor/rust:alive_rs", + actual = "//score/launch_manager/alive/src/rust:alive_rs", ) alias( diff --git a/score/launch_manager/alive/BUILD b/score/launch_manager/alive/BUILD new file mode 100644 index 000000000..d7f49062b --- /dev/null +++ b/score/launch_manager/alive/BUILD @@ -0,0 +1,29 @@ +# ******************************************************************************* +# Copyright (c) 2025 Contributors to the Eclipse Foundation +# +# See the NOTICE file(s) distributed with this work for additional +# information regarding copyright ownership. +# +# This program and the accompanying materials are made available under the +# terms of the Apache License Version 2.0 which is available at +# https://www.apache.org/licenses/LICENSE-2.0 +# +# SPDX-License-Identifier: Apache-2.0 +# ******************************************************************************* +load("@rules_cc//cc:defs.bzl", "cc_library") + +cc_library( + name = "alive", + srcs = [ + "src/alive.cpp", + ], + hdrs = [ + "src/alive.h", + ], + include_prefix = "score/mw/lifecycle", + strip_include_prefix = "/score/launch_manager/alive/src", + visibility = ["//score:__subpackages__"], + deps = [ + "//score/launch_manager/alive/src/details:alive_impl", + ] +) \ No newline at end of file diff --git a/score/launch_manager/daemon/src/alive_monitor/Alive.cpp b/score/launch_manager/alive/src/alive.cpp similarity index 97% rename from score/launch_manager/daemon/src/alive_monitor/Alive.cpp rename to score/launch_manager/alive/src/alive.cpp index 0d7954c17..21dbe7b53 100644 --- a/score/launch_manager/daemon/src/alive_monitor/Alive.cpp +++ b/score/launch_manager/alive/src/alive.cpp @@ -11,7 +11,7 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -#include "score/mw/launch_manager/alive_monitor/Alive.h" +#include "score/mw/lifecycle/alive.h" #include "score/mw/launch_manager/alive_monitor/details/AliveImpl.h" #include diff --git a/score/launch_manager/daemon/src/alive_monitor/Alive.h b/score/launch_manager/alive/src/alive.h similarity index 100% rename from score/launch_manager/daemon/src/alive_monitor/Alive.h rename to score/launch_manager/alive/src/alive.h diff --git a/score/launch_manager/daemon/src/alive_monitor/details/AliveImpl.cpp b/score/launch_manager/alive/src/details/AliveImpl.cpp similarity index 100% rename from score/launch_manager/daemon/src/alive_monitor/details/AliveImpl.cpp rename to score/launch_manager/alive/src/details/AliveImpl.cpp diff --git a/score/launch_manager/daemon/src/alive_monitor/details/AliveImpl.h b/score/launch_manager/alive/src/details/AliveImpl.h similarity index 100% rename from score/launch_manager/daemon/src/alive_monitor/details/AliveImpl.h rename to score/launch_manager/alive/src/details/AliveImpl.h diff --git a/score/launch_manager/daemon/src/alive_monitor/details/AliveImpl_UT.cpp b/score/launch_manager/alive/src/details/AliveImpl_UT.cpp similarity index 100% rename from score/launch_manager/daemon/src/alive_monitor/details/AliveImpl_UT.cpp rename to score/launch_manager/alive/src/details/AliveImpl_UT.cpp diff --git a/score/launch_manager/daemon/src/alive_monitor/details/BUILD b/score/launch_manager/alive/src/details/BUILD similarity index 77% rename from score/launch_manager/daemon/src/alive_monitor/details/BUILD rename to score/launch_manager/alive/src/details/BUILD index 9eda3bd8e..0db00e02d 100644 --- a/score/launch_manager/daemon/src/alive_monitor/details/BUILD +++ b/score/launch_manager/alive/src/details/BUILD @@ -1,5 +1,5 @@ # ******************************************************************************* -# Copyright (c) 2026 Contributors to the Eclipse Foundation +# Copyright (c) 2025 Contributors to the Eclipse Foundation # # See the NOTICE file(s) distributed with this work for additional # information regarding copyright ownership. @@ -10,7 +10,7 @@ # # SPDX-License-Identifier: Apache-2.0 # ******************************************************************************* -load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test") +load("@rules_cc//cc:defs.bzl", "cc_library") cc_test( name = "AliveImpl_UT", @@ -26,10 +26,9 @@ cc_library( srcs = ["AliveImpl.cpp"], hdrs = ["AliveImpl.h"], include_prefix = "score/mw/launch_manager/alive_monitor/details", - strip_include_prefix = "/score/launch_manager/daemon/src/alive_monitor/details", - visibility = ["//score/launch_manager/daemon/src/alive_monitor:__subpackages__"], + strip_include_prefix = "/score/launch_manager/alive/src/details", + visibility = ["//score/launch_manager/alive:__pkg__"], deps = [ - "//score/launch_manager/daemon/src/alive_monitor:config", "//score/launch_manager/daemon/src/alive_monitor/details/ifappl:data_structures", "//score/launch_manager/daemon/src/alive_monitor/details/ipc:ipc_if", "//score/launch_manager/daemon/src/alive_monitor/details/logging:phm_logging", diff --git a/score/launch_manager/daemon/src/alive_monitor/rust/BUILD b/score/launch_manager/alive/src/rust/BUILD similarity index 100% rename from score/launch_manager/daemon/src/alive_monitor/rust/BUILD rename to score/launch_manager/alive/src/rust/BUILD diff --git a/score/launch_manager/daemon/src/alive_monitor/rust/Cargo.lock b/score/launch_manager/alive/src/rust/Cargo.lock similarity index 100% rename from score/launch_manager/daemon/src/alive_monitor/rust/Cargo.lock rename to score/launch_manager/alive/src/rust/Cargo.lock diff --git a/score/launch_manager/daemon/src/alive_monitor/rust/Cargo.toml b/score/launch_manager/alive/src/rust/Cargo.toml similarity index 100% rename from score/launch_manager/daemon/src/alive_monitor/rust/Cargo.toml rename to score/launch_manager/alive/src/rust/Cargo.toml diff --git a/score/launch_manager/daemon/src/alive_monitor/rust/src/alive.rs b/score/launch_manager/alive/src/rust/src/alive.rs similarity index 100% rename from score/launch_manager/daemon/src/alive_monitor/rust/src/alive.rs rename to score/launch_manager/alive/src/rust/src/alive.rs diff --git a/score/launch_manager/daemon/src/alive_monitor/rust/src/errors.rs b/score/launch_manager/alive/src/rust/src/errors.rs similarity index 100% rename from score/launch_manager/daemon/src/alive_monitor/rust/src/errors.rs rename to score/launch_manager/alive/src/rust/src/errors.rs diff --git a/score/launch_manager/daemon/src/alive_monitor/rust/src/lib.rs b/score/launch_manager/alive/src/rust/src/lib.rs similarity index 100% rename from score/launch_manager/daemon/src/alive_monitor/rust/src/lib.rs rename to score/launch_manager/alive/src/rust/src/lib.rs diff --git a/score/launch_manager/daemon/src/alive_monitor/BUILD b/score/launch_manager/daemon/src/alive_monitor/BUILD index e87027b6e..94204115a 100644 --- a/score/launch_manager/daemon/src/alive_monitor/BUILD +++ b/score/launch_manager/daemon/src/alive_monitor/BUILD @@ -37,36 +37,6 @@ cc_library( visibility = ["//score/launch_manager/daemon/src/alive_monitor:__subpackages__"], ) -cc_library( - name = "alive_monitor_h", - hdrs = [ - "Alive.h", - ], - include_prefix = "score/mw/launch_manager/alive_monitor", - strip_include_prefix = "/score/launch_manager/daemon/src/alive_monitor", - visibility = ["//score/launch_manager/daemon/src/alive_monitor:__subpackages__"], -) - -cc_library( - name = "am-lib", - srcs = [ - "Alive.cpp", - ], - hdrs = [ - "Alive.h", - ], - include_prefix = "score/mw/launch_manager/alive_monitor", - strip_include_prefix = "/score/launch_manager/daemon/src/alive_monitor", - visibility = ["//score:__subpackages__"], - deps = [ - ":alive_monitor_h", - "//score/launch_manager/daemon/src/alive_monitor/details:alive_impl", - ] + select({ - "@platforms//os:qnx": [], - "@platforms//os:linux": ["//externals/acl"], - }), -) - cc_library( name = "alive_monitor", visibility = ["//score:__subpackages__"], @@ -74,20 +44,3 @@ cc_library( "//score/launch_manager/daemon/src/alive_monitor/details/daemon:alive_monitor_impl", ], ) - -cc_library( - name = "am_shared_lib", - hdrs = [ - "Alive.h", - ], - include_prefix = "score/mw/launch_manager/alive_monitor", - strip_include_prefix = "/score/launch_manager/daemon/src/alive_monitor", - visibility = ["//score:__subpackages__"], - deps = [ - ":am-lib", - "//score/launch_manager/daemon/src/alive_monitor/details/ipc:ipc_if", - "//score/launch_manager/daemon/src/alive_monitor/details/logging:phm_logging", - "//score/launch_manager/daemon/src/alive_monitor/details/timers:timers_os_clock", - ], - alwayslink = True, -) diff --git a/score/launch_manager/daemon/src/alive_monitor/details/daemon/BUILD b/score/launch_manager/daemon/src/alive_monitor/details/daemon/BUILD index b230acfd8..035f4928b 100644 --- a/score/launch_manager/daemon/src/alive_monitor/details/daemon/BUILD +++ b/score/launch_manager/daemon/src/alive_monitor/details/daemon/BUILD @@ -67,7 +67,7 @@ cc_library( ) cc_library( - name = "i_health_monitor", + name = "i_alive_monitor", hdrs = ["IAliveMonitor.hpp"], include_prefix = "score/mw/launch_manager/alive_monitor/details/daemon", strip_include_prefix = "/score/launch_manager/daemon/src/alive_monitor/details/daemon", @@ -83,7 +83,7 @@ cc_library( strip_include_prefix = "/score/launch_manager/daemon/src/alive_monitor/details/daemon", visibility = ["//score/launch_manager/daemon:__subpackages__"], deps = [ - ":i_health_monitor", + ":i_alive_monitor", "//score/launch_manager/daemon/src/alive_monitor/details/logging:phm_logging", "//score/launch_manager/daemon/src/alive_monitor/details/watchdog:watchdog_impl", ], diff --git a/score/launch_manager/daemon/src/alive_monitor/details/factory/BUILD b/score/launch_manager/daemon/src/alive_monitor/details/factory/BUILD index 8ecfb62cd..d65f2b878 100644 --- a/score/launch_manager/daemon/src/alive_monitor/details/factory/BUILD +++ b/score/launch_manager/daemon/src/alive_monitor/details/factory/BUILD @@ -51,10 +51,7 @@ cc_library( "//score/launch_manager/daemon/src/alive_monitor/details/timers:timers_os_clock", "//score/launch_manager/daemon/src/alive_monitor/details/watchdog:i_device_config_factory", "@flatbuffers", - ] + select({ - "@platforms//os:qnx": [], - "@platforms//os:linux": ["//externals/acl"], - }), + ] ) cc_library( @@ -80,8 +77,5 @@ cc_library( "//score/launch_manager/daemon/src/alive_monitor/details/timers:timers_os_clock", "//score/launch_manager/daemon/src/common:identifier_hash", "@flatbuffers", - ] + select({ - "@platforms//os:qnx": [], - "@platforms//os:linux": ["//externals/acl"], - }), + ] ) diff --git a/score/launch_manager/daemon/src/alive_monitor/details/ifappl/BUILD b/score/launch_manager/daemon/src/alive_monitor/details/ifappl/BUILD index a74946711..f1521e829 100644 --- a/score/launch_manager/daemon/src/alive_monitor/details/ifappl/BUILD +++ b/score/launch_manager/daemon/src/alive_monitor/details/ifappl/BUILD @@ -17,7 +17,10 @@ cc_library( hdrs = ["DataStructures.hpp"], include_prefix = "score/mw/launch_manager/alive_monitor/details/ifappl", strip_include_prefix = "/score/launch_manager/daemon/src/alive_monitor/details/ifappl", - visibility = ["//score/launch_manager/daemon/src/alive_monitor:__subpackages__"], + visibility = [ + "//score/launch_manager/alive:__subpackages__", + "//score/launch_manager/daemon/src/alive_monitor:__subpackages__", + ], deps = [ "//score/launch_manager/daemon/src/alive_monitor/details/ipc:ipc_if", "//score/launch_manager/daemon/src/alive_monitor/details/timers:timers_os_clock", diff --git a/score/launch_manager/daemon/src/alive_monitor/details/ipc/BUILD b/score/launch_manager/daemon/src/alive_monitor/details/ipc/BUILD index d5914443c..074217172 100644 --- a/score/launch_manager/daemon/src/alive_monitor/details/ipc/BUILD +++ b/score/launch_manager/daemon/src/alive_monitor/details/ipc/BUILD @@ -21,7 +21,10 @@ cc_library( ], include_prefix = "score/mw/launch_manager/alive_monitor/details/ipc", strip_include_prefix = "/score/launch_manager/daemon/src/alive_monitor/details/ipc", - visibility = ["//score/launch_manager/daemon/src/alive_monitor:__subpackages__"], + visibility = [ + "//score/launch_manager/alive:__subpackages__", + "//score/launch_manager/daemon/src/alive_monitor:__subpackages__", + ], deps = ["//externals/ipc_dropin"] + select({ "@platforms//os:qnx": [], "@platforms//os:linux": ["//externals/acl"], diff --git a/score/launch_manager/daemon/src/alive_monitor/details/logging/BUILD b/score/launch_manager/daemon/src/alive_monitor/details/logging/BUILD index 4da571eea..90b5050d1 100644 --- a/score/launch_manager/daemon/src/alive_monitor/details/logging/BUILD +++ b/score/launch_manager/daemon/src/alive_monitor/details/logging/BUILD @@ -22,6 +22,9 @@ cc_library( }), include_prefix = "score/mw/launch_manager/alive_monitor/details/logging", strip_include_prefix = "/score/launch_manager/daemon/src/alive_monitor/details/logging", - visibility = ["//score/launch_manager/daemon/src/alive_monitor:__subpackages__"], + visibility = [ + "//score/launch_manager/alive:__subpackages__", + "//score/launch_manager/daemon/src/alive_monitor:__subpackages__", + ], deps = ["@score_baselibs//score/mw/log"], ) diff --git a/score/launch_manager/daemon/src/alive_monitor/details/supervision/BUILD b/score/launch_manager/daemon/src/alive_monitor/details/supervision/BUILD index 34ec488e6..31bef4cf7 100644 --- a/score/launch_manager/daemon/src/alive_monitor/details/supervision/BUILD +++ b/score/launch_manager/daemon/src/alive_monitor/details/supervision/BUILD @@ -47,7 +47,6 @@ cc_library( deps = [ ":i_supervision", ":supervision_cfg", - "//score/launch_manager/daemon/src/alive_monitor:alive_monitor_h", "//score/launch_manager/daemon/src/alive_monitor/details/common:time_sorting_buffer", "//score/launch_manager/daemon/src/alive_monitor/details/ifappl:checkpoint", "//score/launch_manager/daemon/src/alive_monitor/details/ifexm:process_state", diff --git a/score/launch_manager/daemon/src/alive_monitor/details/timers/BUILD b/score/launch_manager/daemon/src/alive_monitor/details/timers/BUILD index ab3a95670..d8c684236 100644 --- a/score/launch_manager/daemon/src/alive_monitor/details/timers/BUILD +++ b/score/launch_manager/daemon/src/alive_monitor/details/timers/BUILD @@ -32,7 +32,10 @@ cc_library( ], include_prefix = "score/mw/launch_manager/alive_monitor/details/timers", strip_include_prefix = "/score/launch_manager/daemon/src/alive_monitor/details/timers", - visibility = ["//score/launch_manager/daemon/src/alive_monitor:__subpackages__"], + visibility = [ + "//score/launch_manager/alive:__subpackages__", + "//score/launch_manager/daemon/src/alive_monitor:__subpackages__", + ], ) alias( From 03bdf1ba3268d9efbed20907493d81da20935594 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20Fu=C3=9Fberger?= Date: Fri, 5 Jun 2026 15:45:49 +0200 Subject: [PATCH 08/18] Remove checkpoint ids from public API --- .../score_supervisor_api_client.rs | 3 +-- score/launch_manager/alive/src/alive.cpp | 11 +++++++---- score/launch_manager/alive/src/alive.h | 11 ++++------- score/launch_manager/alive/src/rust/src/alive.rs | 9 ++++----- 4 files changed, 16 insertions(+), 18 deletions(-) diff --git a/score/health_monitor/src/rust/supervisor_api_client/score_supervisor_api_client.rs b/score/health_monitor/src/rust/supervisor_api_client/score_supervisor_api_client.rs index a96fc06a6..5b9b3f701 100644 --- a/score/health_monitor/src/rust/supervisor_api_client/score_supervisor_api_client.rs +++ b/score/health_monitor/src/rust/supervisor_api_client/score_supervisor_api_client.rs @@ -15,7 +15,6 @@ use crate::log::debug; use crate::supervisor_api_client::SupervisorAPIClient; -use crate::worker::Checks; pub struct ScoreSupervisorAPIClient { supervisor_link: alive_rs::Alive, @@ -35,6 +34,6 @@ impl ScoreSupervisorAPIClient { impl SupervisorAPIClient for ScoreSupervisorAPIClient { fn notify_alive(&self) { - self.supervisor_link.report_checkpoint(Checks::WorkerCheckpoint as u32); + self.supervisor_link.report_alive(); } } diff --git a/score/launch_manager/alive/src/alive.cpp b/score/launch_manager/alive/src/alive.cpp index 21dbe7b53..188724c44 100644 --- a/score/launch_manager/alive/src/alive.cpp +++ b/score/launch_manager/alive/src/alive.cpp @@ -16,6 +16,9 @@ #include +// The public API is only sending alive notification. No need to support different checkpoints. +static constexpr std::uint32_t kDefaultCheckpointId{1U}; + namespace score::mw::lifecycle { @@ -42,11 +45,11 @@ Alive& Alive::operator=(Alive&& se) noexcept Alive::~Alive() noexcept = default; -void Alive::ReportCheckpoint(std::uint32_t checkpointId) const noexcept +void Alive::ReportAlive() const noexcept { if (aliveImplPtr.get() != nullptr) { - aliveImplPtr->ReportCheckpoint(checkpointId); + aliveImplPtr->ReportCheckpoint(kDefaultCheckpointId); } } @@ -72,8 +75,8 @@ void score_lcm_alive_deinitialize(void* instance) noexcept { delete alivePtr; } -void score_lcm_alive_report_checkpoint(void* instance, std::uint32_t checkpointId) noexcept { - static_cast(instance)->ReportCheckpoint(checkpointId); +void score_lcm_alive_report_alive(void* instance) noexcept { + static_cast(instance)->ReportAlive(); } #ifdef __cplusplus diff --git a/score/launch_manager/alive/src/alive.h b/score/launch_manager/alive/src/alive.h index 18819f470..89aab0283 100644 --- a/score/launch_manager/alive/src/alive.h +++ b/score/launch_manager/alive/src/alive.h @@ -52,13 +52,10 @@ class Alive /// @brief Destructor of an Alive virtual ~Alive() noexcept; - /// @brief Reports an occurrence of a Checkpoint - /// @param [in] checkpointId Checkpoint identifier. + /// @brief Reports an alive notification /// @remark Thread safety: - /// Report Checkpoint is NOT thread safe. - /// In case a Monitor is shared between threads or in case two Monitor's are constructed - /// with the same instance specifier in different threads a common lock before calling ReportCheckpoint is required. - void ReportCheckpoint(std::uint32_t checkpointId) const noexcept; + /// This method is NOT thread safe. + void ReportAlive() const noexcept; private: /// @brief Unique pointer to implementation class of Alive @@ -71,7 +68,7 @@ extern "C" #endif void* score_lcm_alive_initialize(const char* instanceSpecifier) noexcept; void score_lcm_alive_deinitialize(void* instance) noexcept; - void score_lcm_alive_report_checkpoint(void* instance, std::uint32_t checkpointId) noexcept; + void score_lcm_alive_report_alive(void* instance) noexcept; #ifdef __cplusplus } #endif diff --git a/score/launch_manager/alive/src/rust/src/alive.rs b/score/launch_manager/alive/src/rust/src/alive.rs index 9a4868d79..99796c185 100644 --- a/score/launch_manager/alive/src/rust/src/alive.rs +++ b/score/launch_manager/alive/src/rust/src/alive.rs @@ -11,14 +11,14 @@ // SPDX-License-Identifier: Apache-2.0 // ******************************************************************************* use crate::errors; -use libc::{c_char, c_uint, c_void}; +use libc::{c_char, c_void}; use std::ffi::CString; #[link(name = "lifecycle_client")] unsafe extern "C" { fn score_lcm_alive_initialize(instanceSpecifier: *const c_char) -> *mut c_void; fn score_lcm_alive_deinitialize(instance: *mut c_void); - fn score_lcm_alive_report_checkpoint(instance: *mut c_void, checkpoint_id: c_uint); + fn score_lcm_alive_report_alive(instance: *mut c_void); } pub struct Alive { @@ -47,10 +47,9 @@ impl Alive { Ok(tmp_inst) } - pub fn report_checkpoint(&self, checkpoint_id: u32) { - let id: u32 = checkpoint_id.into(); + pub fn report_alive(&self) { unsafe { - score_lcm_alive_report_checkpoint(self.instance_ptr, id); + score_lcm_alive_report_alive(self.instance_ptr); } } } From 6c177e1bb51f3c7e7109e219f6beb96964513fc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20Fu=C3=9Fberger?= Date: Fri, 5 Jun 2026 16:02:51 +0200 Subject: [PATCH 09/18] Cleanup doxygen --- score/launch_manager/alive/src/alive.cpp | 1 - score/launch_manager/alive/src/alive.h | 4 ++-- score/launch_manager/alive/src/details/AliveImpl.h | 4 ++-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/score/launch_manager/alive/src/alive.cpp b/score/launch_manager/alive/src/alive.cpp index 188724c44..2fd193970 100644 --- a/score/launch_manager/alive/src/alive.cpp +++ b/score/launch_manager/alive/src/alive.cpp @@ -55,7 +55,6 @@ void Alive::ReportAlive() const noexcept } // namespace score::mw::lifecycle -enum class Dummy : std::uint32_t {}; #ifdef __cplusplus extern "C" { diff --git a/score/launch_manager/alive/src/alive.h b/score/launch_manager/alive/src/alive.h index 89aab0283..e922ccc0a 100644 --- a/score/launch_manager/alive/src/alive.h +++ b/score/launch_manager/alive/src/alive.h @@ -29,8 +29,8 @@ class Alive { public: /// @brief Creation of an Alive. - /// @param [in] instance Instance specifier of the Monitor - /// @throws std::runtime_error in case of an error loading the process-specific configuration + /// @param [in] instance Instance specifier (currently unused) + /// @throws std::runtime_error if the configured IPC channel to connect to launch manager is not existing /// @throws std::bad_alloc in case of insufficient memory explicit Alive(const std::string_view& instance) noexcept(false); diff --git a/score/launch_manager/alive/src/details/AliveImpl.h b/score/launch_manager/alive/src/details/AliveImpl.h index 4f5e1125d..dc6cd0384 100644 --- a/score/launch_manager/alive/src/details/AliveImpl.h +++ b/score/launch_manager/alive/src/details/AliveImpl.h @@ -11,8 +11,8 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -#ifndef SCORE_LCM_AliveImpl_H_ -#define SCORE_LCM_AliveImpl_H_ +#ifndef SCORE_LCM_ALIVEIMPL_H_ +#define SCORE_LCM_ALIVEIMPL_H_ #include #include From 3ee753cf9f29f7f47f6af735ccc6cd280947b149 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20Fu=C3=9Fberger?= Date: Fri, 5 Jun 2026 16:06:44 +0200 Subject: [PATCH 10/18] Fix bazel formatting --- score/launch_manager/alive/BUILD | 4 ++-- score/launch_manager/alive/src/rust/BUILD | 2 +- .../daemon/src/alive_monitor/details/factory/BUILD | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/score/launch_manager/alive/BUILD b/score/launch_manager/alive/BUILD index d7f49062b..343150725 100644 --- a/score/launch_manager/alive/BUILD +++ b/score/launch_manager/alive/BUILD @@ -25,5 +25,5 @@ cc_library( visibility = ["//score:__subpackages__"], deps = [ "//score/launch_manager/alive/src/details:alive_impl", - ] -) \ No newline at end of file + ], +) diff --git a/score/launch_manager/alive/src/rust/BUILD b/score/launch_manager/alive/src/rust/BUILD index 9e2c97dcd..af7f4dae1 100644 --- a/score/launch_manager/alive/src/rust/BUILD +++ b/score/launch_manager/alive/src/rust/BUILD @@ -15,9 +15,9 @@ load("@rules_rust//rust:defs.bzl", "rust_library") rust_library( name = "alive_rs", srcs = [ + "src/alive.rs", "src/errors.rs", "src/lib.rs", - "src/alive.rs", ], visibility = ["//score:__subpackages__"], deps = [ diff --git a/score/launch_manager/daemon/src/alive_monitor/details/factory/BUILD b/score/launch_manager/daemon/src/alive_monitor/details/factory/BUILD index d65f2b878..1997891b3 100644 --- a/score/launch_manager/daemon/src/alive_monitor/details/factory/BUILD +++ b/score/launch_manager/daemon/src/alive_monitor/details/factory/BUILD @@ -51,7 +51,7 @@ cc_library( "//score/launch_manager/daemon/src/alive_monitor/details/timers:timers_os_clock", "//score/launch_manager/daemon/src/alive_monitor/details/watchdog:i_device_config_factory", "@flatbuffers", - ] + ], ) cc_library( @@ -77,5 +77,5 @@ cc_library( "//score/launch_manager/daemon/src/alive_monitor/details/timers:timers_os_clock", "//score/launch_manager/daemon/src/common:identifier_hash", "@flatbuffers", - ] + ], ) From 447d12d94267525de9f7419944f1bae569e83b2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20Fu=C3=9Fberger?= Date: Fri, 5 Jun 2026 16:23:49 +0200 Subject: [PATCH 11/18] Correct cargo files --- Cargo.toml | 2 +- score/launch_manager/alive/src/rust/BUILD | 1 - score/launch_manager/alive/src/rust/src/alive.rs | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 26372622f..063713a29 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ resolver = "2" members = [ "score/launch_manager/lifecycle_client/src/rust", - "score/launch_manager/daemon/src/alive_monitor/rust", + "score/launch_manager/alive/src/rust", "score/health_monitor/src", "examples/rust_supervised_app", ] diff --git a/score/launch_manager/alive/src/rust/BUILD b/score/launch_manager/alive/src/rust/BUILD index af7f4dae1..b2b733cd7 100644 --- a/score/launch_manager/alive/src/rust/BUILD +++ b/score/launch_manager/alive/src/rust/BUILD @@ -22,7 +22,6 @@ rust_library( visibility = ["//score:__subpackages__"], deps = [ "//score/launch_manager:alive_cc", - "//score/launch_manager/lifecycle_client", "@score_crates//:libc", ], ) diff --git a/score/launch_manager/alive/src/rust/src/alive.rs b/score/launch_manager/alive/src/rust/src/alive.rs index 99796c185..2be2e307f 100644 --- a/score/launch_manager/alive/src/rust/src/alive.rs +++ b/score/launch_manager/alive/src/rust/src/alive.rs @@ -14,7 +14,7 @@ use crate::errors; use libc::{c_char, c_void}; use std::ffi::CString; -#[link(name = "lifecycle_client")] +#[link(name = "alive")] unsafe extern "C" { fn score_lcm_alive_initialize(instanceSpecifier: *const c_char) -> *mut c_void; fn score_lcm_alive_deinitialize(instance: *mut c_void); From 31db29ad63aa83165e0d180aa69777cbc7c61d5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20Fu=C3=9Fberger?= Date: Mon, 8 Jun 2026 07:19:30 +0200 Subject: [PATCH 12/18] Add doxygen documentation --- score/launch_manager/alive/src/alive.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/score/launch_manager/alive/src/alive.h b/score/launch_manager/alive/src/alive.h index e922ccc0a..e41a52911 100644 --- a/score/launch_manager/alive/src/alive.h +++ b/score/launch_manager/alive/src/alive.h @@ -24,7 +24,13 @@ namespace score::mw::lifecycle // Forward declaration class AliveImpl; -/// @brief Alive Class +/// @brief Alive API for reporting alive notifications to the launch manager. +/// An alive notification indicates that the component is still active and functioning correctly. +/// The launch manager is configured with an expected alive notification interval, +/// and if it does not receive an alive notification within that interval, +/// it executes the configured recovery action. +/// +/// Each process may only use a single Alive instance. class Alive { public: @@ -53,8 +59,7 @@ class Alive virtual ~Alive() noexcept; /// @brief Reports an alive notification - /// @remark Thread safety: - /// This method is NOT thread safe. + /// @remark Thread safety: This method is NOT thread safe. void ReportAlive() const noexcept; private: From 2278cded11aaad9a09ef3f0b2eb3f80d8453f86d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20Fu=C3=9Fberger?= Date: Mon, 8 Jun 2026 12:42:18 +0200 Subject: [PATCH 13/18] Update copyright header --- score/launch_manager/alive/BUILD | 2 +- score/launch_manager/alive/src/alive.cpp | 2 +- score/launch_manager/alive/src/alive.h | 2 +- score/launch_manager/alive/src/details/BUILD | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/score/launch_manager/alive/BUILD b/score/launch_manager/alive/BUILD index 343150725..eac45be93 100644 --- a/score/launch_manager/alive/BUILD +++ b/score/launch_manager/alive/BUILD @@ -1,5 +1,5 @@ # ******************************************************************************* -# Copyright (c) 2025 Contributors to the Eclipse Foundation +# Copyright (c) 2026 Contributors to the Eclipse Foundation # # See the NOTICE file(s) distributed with this work for additional # information regarding copyright ownership. diff --git a/score/launch_manager/alive/src/alive.cpp b/score/launch_manager/alive/src/alive.cpp index 2fd193970..12bd6ab2b 100644 --- a/score/launch_manager/alive/src/alive.cpp +++ b/score/launch_manager/alive/src/alive.cpp @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (c) 2025 Contributors to the Eclipse Foundation + * Copyright (c) 2026 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional * information regarding copyright ownership. diff --git a/score/launch_manager/alive/src/alive.h b/score/launch_manager/alive/src/alive.h index e41a52911..00c2476a4 100644 --- a/score/launch_manager/alive/src/alive.h +++ b/score/launch_manager/alive/src/alive.h @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (c) 2025 Contributors to the Eclipse Foundation + * Copyright (c) 2026 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional * information regarding copyright ownership. diff --git a/score/launch_manager/alive/src/details/BUILD b/score/launch_manager/alive/src/details/BUILD index 0db00e02d..1fdaf119c 100644 --- a/score/launch_manager/alive/src/details/BUILD +++ b/score/launch_manager/alive/src/details/BUILD @@ -1,5 +1,5 @@ # ******************************************************************************* -# Copyright (c) 2025 Contributors to the Eclipse Foundation +# Copyright (c) 2026 Contributors to the Eclipse Foundation # # See the NOTICE file(s) distributed with this work for additional # information regarding copyright ownership. From a338ba90430398cbb531ddcd313e5817fa15d67e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20Fu=C3=9Fberger?= Date: Thu, 11 Jun 2026 11:44:53 +0200 Subject: [PATCH 14/18] Add ReportFailure method --- score/launch_manager/alive/src/alive.cpp | 10 ++++++++++ score/launch_manager/alive/src/alive.h | 7 +++++++ score/launch_manager/alive/src/rust/src/alive.rs | 7 +++++++ 3 files changed, 24 insertions(+) diff --git a/score/launch_manager/alive/src/alive.cpp b/score/launch_manager/alive/src/alive.cpp index 12bd6ab2b..f03fbde60 100644 --- a/score/launch_manager/alive/src/alive.cpp +++ b/score/launch_manager/alive/src/alive.cpp @@ -53,6 +53,11 @@ void Alive::ReportAlive() const noexcept } } +void Alive::ReportFailure() const noexcept +{ + // Not implemented +} + } // namespace score::mw::lifecycle @@ -78,6 +83,11 @@ void score_lcm_alive_report_alive(void* instance) noexcept { static_cast(instance)->ReportAlive(); } +void score_lcm_alive_report_failure(void* instance) noexcept { + static_cast(instance)->ReportFailure(); +} + + #ifdef __cplusplus } #endif diff --git a/score/launch_manager/alive/src/alive.h b/score/launch_manager/alive/src/alive.h index 00c2476a4..47fb8d198 100644 --- a/score/launch_manager/alive/src/alive.h +++ b/score/launch_manager/alive/src/alive.h @@ -62,6 +62,12 @@ class Alive /// @remark Thread safety: This method is NOT thread safe. void ReportAlive() const noexcept; + /// @brief Report a direct failure + /// @remark Thread safety: This method is NOT thread safe. + /// @note Not Implemented. This method currently does nothing. + [[deprecated("ReportFailure() is not yet implemented")]] + void ReportFailure() const noexcept; + private: /// @brief Unique pointer to implementation class of Alive std::unique_ptr aliveImplPtr; @@ -74,6 +80,7 @@ extern "C" void* score_lcm_alive_initialize(const char* instanceSpecifier) noexcept; void score_lcm_alive_deinitialize(void* instance) noexcept; void score_lcm_alive_report_alive(void* instance) noexcept; + void score_lcm_alive_report_failure(void* instance) noexcept; #ifdef __cplusplus } #endif diff --git a/score/launch_manager/alive/src/rust/src/alive.rs b/score/launch_manager/alive/src/rust/src/alive.rs index 2be2e307f..709167499 100644 --- a/score/launch_manager/alive/src/rust/src/alive.rs +++ b/score/launch_manager/alive/src/rust/src/alive.rs @@ -19,6 +19,7 @@ unsafe extern "C" { fn score_lcm_alive_initialize(instanceSpecifier: *const c_char) -> *mut c_void; fn score_lcm_alive_deinitialize(instance: *mut c_void); fn score_lcm_alive_report_alive(instance: *mut c_void); + unsafe fn score_lcm_alive_report_failure(instance: *mut c_void); } pub struct Alive { @@ -52,6 +53,12 @@ impl Alive { score_lcm_alive_report_alive(self.instance_ptr); } } + + pub fn report_failure(&self) { + unsafe { + score_lcm_alive_report_failure(self.instance_ptr); + } + } } impl Drop for Alive { From 677968a4a7d7f709bf6f17b7155ae028d298df9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20Fu=C3=9Fberger?= Date: Thu, 11 Jun 2026 11:46:35 +0200 Subject: [PATCH 15/18] Correct name in log message --- score/launch_manager/alive/src/rust/src/errors.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/score/launch_manager/alive/src/rust/src/errors.rs b/score/launch_manager/alive/src/rust/src/errors.rs index 6b08025ca..934c6f774 100644 --- a/score/launch_manager/alive/src/rust/src/errors.rs +++ b/score/launch_manager/alive/src/rust/src/errors.rs @@ -17,7 +17,7 @@ pub struct ConstructorError; impl fmt::Display for ConstructorError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "failed to construct Monitor instance") + write!(f, "failed to construct Alive instance") } } From 3d0954ab7a962db601eba428352e64bcb7a4a4fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20Fu=C3=9Fberger?= Date: Tue, 16 Jun 2026 17:09:44 +0200 Subject: [PATCH 16/18] Fixes for Alive API * Introduce nullptr asserts * For non-implement method ReportFailure(), use assert rather than deprecation warning. * Remove C functions from header file. Seems enough to have them in the cpp file --- score/launch_manager/alive/BUILD | 1 + score/launch_manager/alive/src/alive.cpp | 10 +++++++++- score/launch_manager/alive/src/alive.h | 13 ------------- 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/score/launch_manager/alive/BUILD b/score/launch_manager/alive/BUILD index eac45be93..1bf5db413 100644 --- a/score/launch_manager/alive/BUILD +++ b/score/launch_manager/alive/BUILD @@ -25,5 +25,6 @@ cc_library( visibility = ["//score:__subpackages__"], deps = [ "//score/launch_manager/alive/src/details:alive_impl", + "@score_baselibs//score/language/futurecpp", ], ) diff --git a/score/launch_manager/alive/src/alive.cpp b/score/launch_manager/alive/src/alive.cpp index f03fbde60..0d382eb0f 100644 --- a/score/launch_manager/alive/src/alive.cpp +++ b/score/launch_manager/alive/src/alive.cpp @@ -15,6 +15,7 @@ #include "score/mw/launch_manager/alive_monitor/details/AliveImpl.h" #include +#include // The public API is only sending alive notification. No need to support different checkpoints. static constexpr std::uint32_t kDefaultCheckpointId{1U}; @@ -55,7 +56,7 @@ void Alive::ReportAlive() const noexcept void Alive::ReportFailure() const noexcept { - // Not implemented + SCORE_LANGUAGE_FUTURECPP_PRECONDITION_PRD_MESSAGE(false, "Alive::ReportFailure() is not yet implemented"); } } // namespace score::mw::lifecycle @@ -66,6 +67,10 @@ extern "C" { #endif void* score_lcm_alive_initialize(const char* instanceSpecifier) noexcept { + if(instanceSpecifier == nullptr) { + return nullptr; + } + try { auto* alivePtr = new score::mw::lifecycle::Alive(instanceSpecifier); return static_cast(alivePtr); @@ -75,15 +80,18 @@ void* score_lcm_alive_initialize(const char* instanceSpecifier) noexcept { } void score_lcm_alive_deinitialize(void* instance) noexcept { + SCORE_LANGUAGE_FUTURECPP_PRECONDITION(instance != nullptr); auto* alivePtr = static_cast(instance); delete alivePtr; } void score_lcm_alive_report_alive(void* instance) noexcept { + SCORE_LANGUAGE_FUTURECPP_PRECONDITION(instance != nullptr); static_cast(instance)->ReportAlive(); } void score_lcm_alive_report_failure(void* instance) noexcept { + SCORE_LANGUAGE_FUTURECPP_PRECONDITION(instance != nullptr); static_cast(instance)->ReportFailure(); } diff --git a/score/launch_manager/alive/src/alive.h b/score/launch_manager/alive/src/alive.h index 47fb8d198..376cf1bda 100644 --- a/score/launch_manager/alive/src/alive.h +++ b/score/launch_manager/alive/src/alive.h @@ -65,7 +65,6 @@ class Alive /// @brief Report a direct failure /// @remark Thread safety: This method is NOT thread safe. /// @note Not Implemented. This method currently does nothing. - [[deprecated("ReportFailure() is not yet implemented")]] void ReportFailure() const noexcept; private: @@ -73,17 +72,5 @@ class Alive std::unique_ptr aliveImplPtr; }; -#ifdef __cplusplus -extern "C" -{ -#endif - void* score_lcm_alive_initialize(const char* instanceSpecifier) noexcept; - void score_lcm_alive_deinitialize(void* instance) noexcept; - void score_lcm_alive_report_alive(void* instance) noexcept; - void score_lcm_alive_report_failure(void* instance) noexcept; -#ifdef __cplusplus -} -#endif - } // namespace score::mw::lifecycle #endif // SCORE_LCM_ALIVE_H_ From c7019a4febc77659163d3eb44c3d1d41a1eff9b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20Fu=C3=9Fberger?= Date: Thu, 18 Jun 2026 09:09:39 +0200 Subject: [PATCH 17/18] Default move ctor and assignment --- score/launch_manager/alive/src/alive.cpp | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/score/launch_manager/alive/src/alive.cpp b/score/launch_manager/alive/src/alive.cpp index 0d382eb0f..53eec5903 100644 --- a/score/launch_manager/alive/src/alive.cpp +++ b/score/launch_manager/alive/src/alive.cpp @@ -28,21 +28,9 @@ Alive::Alive(const std::string_view& instance) noexcept(false) : { } -Alive::Alive(Alive&& se) noexcept : - aliveImplPtr(std::move(se.aliveImplPtr)) -{ -} +Alive::Alive(Alive&& se) noexcept = default; -Alive& Alive::operator=(Alive&& se) noexcept -{ - if (this != &se) - { - aliveImplPtr.reset(nullptr); - aliveImplPtr = std::move(se.aliveImplPtr); - } - - return *this; -} +Alive& Alive::operator=(Alive&& se) noexcept = default; Alive::~Alive() noexcept = default; From 0fe87604ac8a863f486922f533a1726b255a1e52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20Fu=C3=9Fberger?= Date: Thu, 18 Jun 2026 09:20:34 +0200 Subject: [PATCH 18/18] More renaming Monitor -> Alive --- .../alive/src/details/AliveImpl.cpp | 6 ++--- .../alive/src/details/AliveImpl.h | 10 ++++---- .../details/daemon/AliveMonitorImpl.cpp | 8 +++---- .../details/daemon/AliveMonitorImpl.hpp | 4 ++-- .../details/daemon/IAliveMonitor.hpp | 8 +++---- .../details/daemon/SwClusterHandler.cpp | 14 +++++------ .../details/daemon/SwClusterHandler.hpp | 8 +++---- .../details/factory/FlatCfgFactory.cpp | 24 +++++++++---------- .../details/factory/FlatCfgFactory.hpp | 4 ++-- .../details/factory/IPhmFactory.hpp | 16 ++++++------- .../details/ifappl/DataStructures.hpp | 4 ++-- .../details/ifappl/MonitorIfDaemon.hpp | 10 ++++---- 12 files changed, 58 insertions(+), 58 deletions(-) diff --git a/score/launch_manager/alive/src/details/AliveImpl.cpp b/score/launch_manager/alive/src/details/AliveImpl.cpp index ea7cb6f94..2cdc18768 100644 --- a/score/launch_manager/alive/src/details/AliveImpl.cpp +++ b/score/launch_manager/alive/src/details/AliveImpl.cpp @@ -43,7 +43,7 @@ void AliveImpl::connectToPhmDaemon(void) noexcept(false) const auto ipc_path_res = readInterfacePath(); if (ipc_path_res == std::nullopt) { - logger_r.LogError() << "Failed to load interface path for Monitor (" << k_instanceSpecifierPath << ")"; + logger_r.LogError() << "Failed to load interface path for Alive instance (" << k_instanceSpecifierPath << ")"; throw std::runtime_error("Failed to get interface path"); } CheckpointIpcClient::EIpcInitResult initResult{ipcClient->init(ipc_path_res.value())}; @@ -55,10 +55,10 @@ void AliveImpl::connectToPhmDaemon(void) noexcept(false) { const uid_t uid{geteuid()}; logger_r.LogError() << "Connection to PHM daemon failed (permission denied for effective uid" << uid - << "), for the Monitor (" << k_instanceSpecifierPath << ")"; + << "), for the Alive instance (" << k_instanceSpecifierPath << ")"; return; } - logger_r.LogError() << "Connection to PHM daemon failed, for the Monitor (" << k_instanceSpecifierPath << ")"; + logger_r.LogError() << "Connection to PHM daemon failed, for the Alive instance (" << k_instanceSpecifierPath << ")"; } std::optional AliveImpl::readInterfacePath() noexcept diff --git a/score/launch_manager/alive/src/details/AliveImpl.h b/score/launch_manager/alive/src/details/AliveImpl.h index dc6cd0384..af23360f3 100644 --- a/score/launch_manager/alive/src/details/AliveImpl.h +++ b/score/launch_manager/alive/src/details/AliveImpl.h @@ -25,7 +25,7 @@ namespace score::mw::lifecycle { -/// @brief Implementation class for score::mw::lifecycle::Monitor class +/// @brief Implementation class for score::mw::lifecycle::Alive class /// This class is responsible for establishing the connection between the application and PHM daemon /// by invoking the calls to PHM class methods and to forward the reported checkpoints from the application /// to PHM daemon for supervision evaluation @@ -43,8 +43,8 @@ class AliveImpl /// @brief Constructor of AliveImpl class /// @param [in] f_instanceSpecifier_r Instance specifier object with the metamodel path of - /// the Monitor - /// @param [in] f_ipcClient Ipc Connection to PHM daemon + /// the Alive instance + /// @param [in] f_ipcClient Ipc Connection to Launch Manager /// @throws std::runtime_error in case ipc path could not be read from configuration /// @throws std::bad_alloc in case of insufficient memory explicit AliveImpl( @@ -75,12 +75,12 @@ class AliveImpl /// @throws std::runtime_error in case ipc path could not be read from configuration void connectToPhmDaemon(void) noexcept(false); - /// @brief Read the Monitor Interface Path from an environment variable. + /// @brief Read the Alive Interface Path from an environment variable. /// This is then used to initialise the IPC client /// @return Value of environment variable or nullopt if getenv fails static std::optional readInterfacePath() noexcept; - /// @brief Instance specifier path of the Monitor instance + /// @brief Instance specifier path of the Alive instance const std::string k_instanceSpecifierPath; /// @brief IPC Connection to PHM Daemon diff --git a/score/launch_manager/daemon/src/alive_monitor/details/daemon/AliveMonitorImpl.cpp b/score/launch_manager/daemon/src/alive_monitor/details/daemon/AliveMonitorImpl.cpp index 79964286f..4035cb259 100644 --- a/score/launch_manager/daemon/src/alive_monitor/details/daemon/AliveMonitorImpl.cpp +++ b/score/launch_manager/daemon/src/alive_monitor/details/daemon/AliveMonitorImpl.cpp @@ -37,15 +37,15 @@ EInitCode AliveMonitorImpl::init() noexcept { if (initResult == score::lcm::saf::daemon::EInitCode::kNoError) { const long ms{m_osClock.endMeasurement()}; - m_logger.LogDebug() << "HealthMonitor: Initialization took " << ms << " ms"; + m_logger.LogDebug() << "AliveMonitor: Initialization took " << ms << " ms"; } else { - m_logger.LogError() << "HealthMonitor: Initialization failed with error code:" << static_cast(initResult); + m_logger.LogError() << "AliveMonitor: Initialization failed with error code:" << static_cast(initResult); } } catch (const std::exception& e) { - std::cerr << "HealthMonitor: Initialization failed due to standard exception: " << e.what() << ".\n"; + std::cerr << "AliveMonitor: Initialization failed due to standard exception: " << e.what() << ".\n"; initResult = EInitCode::kGeneralError; } catch (...) { - std::cerr << "HealthMonitor: Initialization failed due to exception!\n"; + std::cerr << "AliveMonitor: Initialization failed due to exception!\n"; initResult = EInitCode::kGeneralError; } diff --git a/score/launch_manager/daemon/src/alive_monitor/details/daemon/AliveMonitorImpl.hpp b/score/launch_manager/daemon/src/alive_monitor/details/daemon/AliveMonitorImpl.hpp index 3f8a83603..cf40feaa2 100644 --- a/score/launch_manager/daemon/src/alive_monitor/details/daemon/AliveMonitorImpl.hpp +++ b/score/launch_manager/daemon/src/alive_monitor/details/daemon/AliveMonitorImpl.hpp @@ -10,8 +10,8 @@ * * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -#ifndef SAF_DAEMON_HEALTH_MONITOR_IMPL_HPP_INCLUDED -#define SAF_DAEMON_HEALTH_MONITOR_IMPL_HPP_INCLUDED +#ifndef SAF_DAEMON_ALIVE_MONITOR_IMPL_HPP_INCLUDED +#define SAF_DAEMON_ALIVE_MONITOR_IMPL_HPP_INCLUDED #include #include diff --git a/score/launch_manager/daemon/src/alive_monitor/details/daemon/IAliveMonitor.hpp b/score/launch_manager/daemon/src/alive_monitor/details/daemon/IAliveMonitor.hpp index 624d88a6c..655e8740b 100644 --- a/score/launch_manager/daemon/src/alive_monitor/details/daemon/IAliveMonitor.hpp +++ b/score/launch_manager/daemon/src/alive_monitor/details/daemon/IAliveMonitor.hpp @@ -10,8 +10,8 @@ * * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -#ifndef SAF_DAEMON_HEALTH_MONITOR_HPP_INCLUDED -#define SAF_DAEMON_HEALTH_MONITOR_HPP_INCLUDED +#ifndef SAF_DAEMON_ALIVE_MONITOR_HPP_INCLUDED +#define SAF_DAEMON_ALIVE_MONITOR_HPP_INCLUDED #include @@ -31,11 +31,11 @@ class IAliveMonitor { public: virtual ~IAliveMonitor() = default; - /// @brief Initialize the HealthMonitor functionality + /// @brief Initialize the AliveMonitor functionality /// @return kNoError if initialization was successful, otherwise an appropriate error code. virtual EInitCode init() noexcept = 0; - /// @brief Run the HealthMonitor functionality in a cyclic manner until cancellation is requested. + /// @brief Run the AliveMonitor functionality in a cyclic manner until cancellation is requested. /// @param cancel_thread Atomic boolean flag to signal thread cancellation. virtual bool run(std::atomic_bool& cancel_thread) noexcept = 0; }; diff --git a/score/launch_manager/daemon/src/alive_monitor/details/daemon/SwClusterHandler.cpp b/score/launch_manager/daemon/src/alive_monitor/details/daemon/SwClusterHandler.cpp index 5a5643465..574b0e53c 100644 --- a/score/launch_manager/daemon/src/alive_monitor/details/daemon/SwClusterHandler.cpp +++ b/score/launch_manager/daemon/src/alive_monitor/details/daemon/SwClusterHandler.cpp @@ -31,8 +31,8 @@ SwClusterHandler::SwClusterHandler(const std::string& f_swClusterName_r) : logger_r(logging::PhmLogger::getLogger(logging::PhmLogger::EContext::factory)), f_swClusterName(f_swClusterName_r), processStates{}, - monitorIfIpcs{}, - monitorInterfaces{}, + aliveIfIpcs{}, + aliveInterfaces{}, checkpoints{}, aliveSupervisions{} { @@ -63,15 +63,15 @@ bool SwClusterHandler::constructWorkers( } if (isSuccess) { - isSuccess = flatCfgFactory.createMonitorIfIpcs(monitorIfIpcs); + isSuccess = flatCfgFactory.createAliveIfIpcs(aliveIfIpcs); } if (isSuccess) { - isSuccess = flatCfgFactory.createMonitorIf(monitorInterfaces, monitorIfIpcs, processStates); + isSuccess = flatCfgFactory.createAliveIf(aliveInterfaces, aliveIfIpcs, processStates); } if (isSuccess) { - isSuccess = flatCfgFactory.createSupervisionCheckpoints(checkpoints, monitorInterfaces, processStates); + isSuccess = flatCfgFactory.createSupervisionCheckpoints(checkpoints, aliveInterfaces, processStates); } if (isSuccess) { @@ -87,9 +87,9 @@ bool SwClusterHandler::constructWorkers( void SwClusterHandler::checkInterfaceForNewData(const timers::NanoSecondType f_syncTimestamp) { - for (auto& monitorInterface : monitorInterfaces) + for (auto& aliveInterface : aliveInterfaces) { - monitorInterface.checkForNewData(f_syncTimestamp); + aliveInterface.checkForNewData(f_syncTimestamp); } } diff --git a/score/launch_manager/daemon/src/alive_monitor/details/daemon/SwClusterHandler.hpp b/score/launch_manager/daemon/src/alive_monitor/details/daemon/SwClusterHandler.hpp index dec198d70..7512d6ee9 100644 --- a/score/launch_manager/daemon/src/alive_monitor/details/daemon/SwClusterHandler.hpp +++ b/score/launch_manager/daemon/src/alive_monitor/details/daemon/SwClusterHandler.hpp @@ -125,11 +125,11 @@ class SwClusterHandler /// Vector of Process states std::vector processStates; - /// Vector of Monitor Interface IPCs - std::vector monitorIfIpcs; + /// Vector of Alive Interface IPCs + std::vector aliveIfIpcs; - /// Vector of Monitor Interfaces - std::vector monitorInterfaces; + /// Vector of Alive Interfaces + std::vector aliveInterfaces; /// Vector of Supervision checkpoints std::vector checkpoints; diff --git a/score/launch_manager/daemon/src/alive_monitor/details/factory/FlatCfgFactory.cpp b/score/launch_manager/daemon/src/alive_monitor/details/factory/FlatCfgFactory.cpp index 49975481e..0f4a8479c 100644 --- a/score/launch_manager/daemon/src/alive_monitor/details/factory/FlatCfgFactory.cpp +++ b/score/launch_manager/daemon/src/alive_monitor/details/factory/FlatCfgFactory.cpp @@ -196,13 +196,13 @@ bool FlatCfgFactory::initIpcServerWithUidBasedAccess(ifappl::CheckpointIpcServer if (!f_ipcServer_r.setAccessRights(uid)) { logger_r.LogError() << kLogPrefix << "Could not set ACL permissions (r/w for uid" << uid - << ") for Monitor interface IPC with path:" << f_ipcPath_r; + << ") for Alive interface IPC with path:" << f_ipcPath_r; return false; } return true; } -bool FlatCfgFactory::createMonitorIfIpcs(std::vector& f_interfaceIpcs_r) +bool FlatCfgFactory::createAliveIfIpcs(std::vector& f_interfaceIpcs_r) { bool isSuccess{true}; if (flatBuffer_p->hmMonitorInterface() != nullptr) @@ -223,12 +223,12 @@ bool FlatCfgFactory::createMonitorIfIpcs(std::vector(f_interfaceIpcs_r.size()); } else { f_interfaceIpcs_r.clear(); - logger_r.LogError() << kLogPrefix << "Could not create all necessary Monitor interface IPCs."; + logger_r.LogError() << kLogPrefix << "Could not create all necessary Alive interface IPCs."; } return isSuccess; } -bool FlatCfgFactory::createMonitorIf(std::vector& f_interfaces_r, +bool FlatCfgFactory::createAliveIf(std::vector& f_interfaces_r, std::vector& f_interfaceIpcs_r, std::vector& f_processStates_r) { @@ -282,19 +282,19 @@ bool FlatCfgFactory::createMonitorIf(std::vector& f_int f_processStates_r.at(static_cast(refProcessIndex)).attachObserver(f_interfaces_r.back()); logger_r.LogDebug() << kLogPrefix - << "Successfully created MonitorInterface:" << f_interfaces_r.back().getInterfaceName(); + << "Successfully created Alive Interface:" << f_interfaces_r.back().getInterfaceName(); // coverity[autosar_cpp14_a4_7_1_violation] Value limited by amount of interfaces, which is smaller. index++; } - logger_r.LogDebug() << kLogPrefix << "Number of constructed Monitor interfaces:" + logger_r.LogDebug() << kLogPrefix << "Number of constructed Alive interfaces:" << static_cast(f_interfaces_r.size()); } catch (const std::exception& f_exception_r) { isSuccess = false; f_interfaces_r.clear(); - logger_r.LogError() << kLogPrefix << "Could not create all necessary Monitor interfaces due to exception:" + logger_r.LogError() << kLogPrefix << "Could not create all necessary Alive interfaces due to exception:" << std::string_view{f_exception_r.what()}; } diff --git a/score/launch_manager/daemon/src/alive_monitor/details/factory/FlatCfgFactory.hpp b/score/launch_manager/daemon/src/alive_monitor/details/factory/FlatCfgFactory.hpp index f0aee86af..d9ddd870a 100644 --- a/score/launch_manager/daemon/src/alive_monitor/details/factory/FlatCfgFactory.hpp +++ b/score/launch_manager/daemon/src/alive_monitor/details/factory/FlatCfgFactory.hpp @@ -83,10 +83,10 @@ class FlatCfgFactory : public IPhmFactory ifexm::ProcessStateReader& f_processStateReader_r) override; /// Refer to the description of the base class (IPhmFactory) - bool createMonitorIfIpcs(std::vector& f_interfaceIpcs_r) override; + bool createAliveIfIpcs(std::vector& f_interfaceIpcs_r) override; /// Refer to the description of the base class (IPhmFactory) - bool createMonitorIf(std::vector& f_interfaces_r, + bool createAliveIf(std::vector& f_interfaces_r, std::vector& f_interfaceIpcs_r, std::vector& f_processStates_r) override; diff --git a/score/launch_manager/daemon/src/alive_monitor/details/factory/IPhmFactory.hpp b/score/launch_manager/daemon/src/alive_monitor/details/factory/IPhmFactory.hpp index d5e494732..5acad6689 100644 --- a/score/launch_manager/daemon/src/alive_monitor/details/factory/IPhmFactory.hpp +++ b/score/launch_manager/daemon/src/alive_monitor/details/factory/IPhmFactory.hpp @@ -81,23 +81,23 @@ class IPhmFactory virtual bool createProcessStates(std::vector& f_processStates_r, ifexm::ProcessStateReader& f_processStateReader_r) = 0; - /// @brief Create IPCs for Monitor Interfaces - /// @param [out] f_interfaceIpcs_r Vector of created Monitor Interface IPCs + /// @brief Create IPCs for Alive Interfaces + /// @param [out] f_interfaceIpcs_r Vector of created Alive Interface IPCs /// @return Object creation successful (true), otherwise failed (false) - virtual bool createMonitorIfIpcs(std::vector& f_interfaceIpcs_r) = 0; + virtual bool createAliveIfIpcs(std::vector& f_interfaceIpcs_r) = 0; - /// @brief Create Monitor Interfaces - /// @param [out] f_interfaces_r Vector of created Monitor Interfaces - /// @param [in] f_interfaceIpcs_r Vector of Monitor Interface IPCs required for interface creation. + /// @brief Create Alive Interfaces + /// @param [out] f_interfaces_r Vector of created Alive Interfaces + /// @param [in] f_interfaceIpcs_r Vector of Alive Interface IPCs required for interface creation. /// @param [in,out] f_processStates_r Vector of Process States /// @return Object creation successful (true), otherwise failed (false) - virtual bool createMonitorIf(std::vector& f_interfaces_r, + virtual bool createAliveIf(std::vector& f_interfaces_r, std::vector& f_interfaceIpcs_r, std::vector& f_processStates_r) = 0; /// @brief Create Supervision Checkpoints /// @param [out] f_checkpoints_r Vector of created Supervision Checkpoints - /// @param [in,out] f_interfaces_r Vector of Monitor Interfaces required for attaching the checkpoints. + /// @param [in,out] f_interfaces_r Vector of Alive Interfaces required for attaching the checkpoints. /// @param [in] f_processStates_r Vector of ProcessStates required for constructing the Checkpoint /// instances. /// @return Object creation successful (true), otherwise failed (false) diff --git a/score/launch_manager/daemon/src/alive_monitor/details/ifappl/DataStructures.hpp b/score/launch_manager/daemon/src/alive_monitor/details/ifappl/DataStructures.hpp index 57c1a8ca9..64ab0adb5 100644 --- a/score/launch_manager/daemon/src/alive_monitor/details/ifappl/DataStructures.hpp +++ b/score/launch_manager/daemon/src/alive_monitor/details/ifappl/DataStructures.hpp @@ -30,8 +30,8 @@ namespace ifappl /// Maximum number of Checkpoints to be stored in IPC channel /// @todo Implement logic to determine the number of checkpoint entries -/// that a Monitor instance can report between two cycles -/// of PHM daemon. +/// that an Alive instance can report between two cycles +/// of AliveMonitor. // coverity[autosar_cpp14_a0_1_1_violation] value is referenced in multiple files, but depending on build package. constexpr uint16_t k_maxCheckpointBufferElements{512U}; diff --git a/score/launch_manager/daemon/src/alive_monitor/details/ifappl/MonitorIfDaemon.hpp b/score/launch_manager/daemon/src/alive_monitor/details/ifappl/MonitorIfDaemon.hpp index 8c88eaeba..ec2d7205a 100644 --- a/score/launch_manager/daemon/src/alive_monitor/details/ifappl/MonitorIfDaemon.hpp +++ b/score/launch_manager/daemon/src/alive_monitor/details/ifappl/MonitorIfDaemon.hpp @@ -40,7 +40,7 @@ class Global; namespace ifappl { -/// @brief Monitor Interface for PHM Deamon +/// @brief Alive Interface for PHM Deamon /// @details The MonitorIfDaemon class provides methods to write/read information to the /// data exchange between PHM daemon and Application, which are only required on PHM Daemon side. class MonitorIfDaemon : public common::Observer @@ -84,7 +84,7 @@ class MonitorIfDaemon : public common::Observer const std::string& getInterfaceName(void) const noexcept(true); /// @brief Attach checkpoint - /// @details Attaches a checkpoint observer to the Monitor interface + /// @details Attaches a checkpoint observer to the Alive interface /// Note: Attached observers will receive updates in case there is new information /// @param [in] f_checkpoint_r Checkpoint which is added to the observer array /// @throws std::bad_alloc in case of insufficient memory for vector allocation @@ -95,7 +95,7 @@ class MonitorIfDaemon : public common::Observer void updateData(const ifexm::ProcessState& f_observable_r) noexcept(true) override; /// @brief Check for new data - /// @details Check Monitor interface for new data from application side + /// @details Check Alive interface for new data from application side /// @param [in] f_syncTimestamp Timestamp till data shall be read, newer data will not be considered void checkForNewData(const score::lcm::saf::timers::NanoSecondType f_syncTimestamp) noexcept(true); @@ -110,7 +110,7 @@ class MonitorIfDaemon : public common::Observer /// @brief Push overflow event information to all checkpoint observer /// @details Every attached checkpoint observer will be informed that a data loss event in the - /// Monitor has occurred + /// Alive interface has occurred void pushOverflowInfoToCheckpointObservers(void) const; /// @brief Move to kInactiveOverflow state and push overflow event to observers @@ -149,7 +149,7 @@ class MonitorIfDaemon : public common::Observer /// Interface name const std::string k_interfaceName; - /// Array of checkpoint observers attached to the Monitor interface + /// Array of checkpoint observers attached to the Alive interface std::vector checkpointObservers{}; /// @brief IPC connection to application