Initial mw::com-based implementation of ilmcontrol interface - #478
Initial mw::com-based implementation of ilmcontrol interface#478NicolasFussberger wants to merge 29 commits into
Conversation
License Check Results🚀 The license check job ran with the Bazel command: bazel run --lockfile_mode=error //:license-checkStatus: Click to expand output |
1c88cfc to
faa5d86
Compare
|
The created documentation from the pull request is available at: docu-html |
|
@NicolasFussberger There are merge conflicts 😄 |
Resolved. Though I had to downgrade again to baselibs 0.2.10, because com is not working with baselibs 0.2.11 yet. |
|
|
||
| # mw::com reads its manifest from the working-directory-relative default path | ||
| # ./etc/mw_com_config.json unless told otherwise via CLI args. | ||
| # CLI args are currently not supported with score_qnx_unit_tests, so |
There was a problem hiding this comment.
Support was added in eclipse-score/qnx_unit_tests@21f6901
| case ExecErrc::kFailedUnexpectedTerminationOnEnter: | ||
| return "Unexpected Termination during transition in Process of target Process Group State happened"; | ||
| case ExecErrc::kInvalidTransition: | ||
| return "Transition invalid (e.g. report kRunning when already in Running Process State)"; |
There was a problem hiding this comment.
Do you think we should further clarify kInvalidTransition I think this was currently use this for what kRunTargetDoesntExist says.
| class LmControlService : public Trait::Base | ||
| { | ||
| public: | ||
| using Trait::Base::Base; |
There was a problem hiding this comment.
I'm guessing this Trait is coming from COM? Can you add a comment to explain this?
| { | ||
|
|
||
| /// @brief Translates a RunTargetActivationSource to a human-readable string for logging. | ||
| constexpr std::string_view toStringView(const RunTargetActivationSource source) noexcept |
There was a problem hiding this comment.
Can you make this into an ostream <<operator or mw::log::LogStream <<operator instead?
| case RunTargetActivationSource::kRecoveryAction: | ||
| return "RecoveryAction"; | ||
| } | ||
| return "Unknown"; |
There was a problem hiding this comment.
I think it's nice to SCORE_LANGUAGE_FUTURECPP_UNREACHABLE(); here because then you should get compiler errors if all cases are not handled.
| #include "score/mw/com/types.h" | ||
| #include "score/mw/lifecycle/ilm_control.hpp" | ||
|
|
||
| namespace score::mw::lifecycle |
There was a problem hiding this comment.
should this be in internal? I think all of the files in detail
There was a problem hiding this comment.
Do you think it would be good to make some sort of component test that includes actual com implementation? I think this could be good when trying to debug interactions between us and COM.
| return score::MakeUnexpected(ExecErrc::kInvalidArguments); | ||
| } | ||
|
|
||
| const auto start_result = Traits::StartFindService( |
There was a problem hiding this comment.
With the interactions with COM could you not use auto as developers unfamiliar would have no idea what the type could be.
| /// traits type whose Proxy is a fake, giving full control | ||
| /// for testing. | ||
| template <typename Traits = MwComProxyTraits> | ||
| class BasicLmControlImpl final : public ILmControl |
There was a problem hiding this comment.
Clever idea to encapsulate the mwcom api with a traits type. 🤓
| const auto stop_result = Traits::StopFindService(find_handle_.value()); | ||
| if (!stop_result.has_value()) | ||
| { | ||
| LM_LOG_ERROR() << "LmControl: StopFindService failed with error:" << stop_result.error(); |
There was a problem hiding this comment.
To my understanding this object is living in a state manager daemon, however it uses lm logging macros which are meant to be used inside lm daemon. Should be better a separate logger like LM(C)I (like Launch Manager (Control) Interface) to see already from the log statement that this code has been not executed in the daemon.
| /// abstraction to expose at this level. Do not treat this interface | ||
| /// as stable until these decisions are resolved. | ||
| /// | ||
| /// Establishes the mw::com connection to the Launch Manager. |
There was a problem hiding this comment.
Is really the connection established or only initiated? What happens synchronously, what asynchronously?
| /// @param[in] callback The callback to invoke, may be empty in which case the sample is dropped. | ||
| /// @param[in] sample The received activation result. | ||
| template <typename SamplePtrType> | ||
| static void forwardSample(const ActivationCallback& callback, const SamplePtrType& sample) noexcept |
There was a problem hiding this comment.
This method is noexcept, but ActivationCallback isn't, which could lead to std::terminate.
However there is no easy way out with std::function and C++17: https://stackoverflow.com/a/31675003
| } | ||
| } | ||
|
|
||
| if (proxy_.has_value()) |
There was a problem hiding this comment.
Does the mutex need to be acquired before accessing proxy_?
| } | ||
| } | ||
|
|
||
| score::Result<void> activate_run_target(RunTargetName runTargetName, bool force = false) override |
There was a problem hiding this comment.
Default value could be dropped here, as it is defined in the interface.
| #include <string> | ||
| #include <string_view> | ||
|
|
||
| #include "score/mw/com/runtime.h" |
Initial implementation of the ilm_control interface using mw::com as the underlying communication framework.
This PR only implements the library-side.
Follow up PR will adapt the launch_manager daemon code to interact with the library via mw::com.
Closes: #480