Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
b3fd4cf
Bring in files
WilliamRoebuck Jul 22, 2026
434a3bc
Moved component event queue, add interface
WilliamRoebuck Jul 23, 2026
8a2637b
Add process monitor UT
WilliamRoebuck Jul 23, 2026
acac15e
More docs
WilliamRoebuck Jul 24, 2026
e98a392
Use rvalue for parameter to `doWork`
danth Jul 27, 2026
6755254
Reduce `waitForEvents` timeout to zero in tests
danth Jul 27, 2026
fb1917a
Rename `Task` to `ComponentTask`
danth Jul 27, 2026
65834e6
Refactor `doWork` method
danth Jul 27, 2026
bc514df
Update namespaces, use new queue format
WilliamRoebuck Jul 28, 2026
f14b166
Changes after review
WilliamRoebuck Jul 28, 2026
0d323bb
Renames, create mock_component.hpp
WilliamRoebuck Jul 28, 2026
2635dc4
Revert changes in constants, add testonly
WilliamRoebuck Jul 28, 2026
ca3ebb3
Improve event queue interfaces
WilliamRoebuck Jul 28, 2026
0e54a6b
Fix incorrect test
WilliamRoebuck Jul 28, 2026
d8a4930
Fix format and copyright
WilliamRoebuck Jul 28, 2026
fedc738
Add nodiscards & handle cases
WilliamRoebuck Jul 28, 2026
7d13fa4
Extract mocks
WilliamRoebuck Jul 28, 2026
418151f
Add some newlines
WilliamRoebuck Jul 28, 2026
8402391
Rename event queue interface
WilliamRoebuck Jul 28, 2026
b479f47
Correct enum comments
WilliamRoebuck Jul 28, 2026
362cf14
Exclude mocks from coverage
WilliamRoebuck Jul 28, 2026
aefa189
Revert "Exclude mocks from coverage"
WilliamRoebuck Jul 29, 2026
27651be
Add comment to clang tidy
WilliamRoebuck Jul 29, 2026
c0740fd
Docs for interface methods
WilliamRoebuck Jul 29, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
Checks: ' -*, bugprone-*, cert-*, clang-analyzer-core.*, clang-analyzer-cplusplus.*, clang-analyzer-security.*, cppcoreguidelines-pro-bounds-pointer-arithmetic, cppcoreguidelines-pro-type-cstyle-cast, hicpp-* '
WarningsAsErrors: 'bugprone-*,cert-*,clang-analyzer-*,hicpp-*'
CheckOptions:
- key: 'hicpp-special-member-functions.AllowSoleDefaultDtor'
- value: 1 # This allows us to make interfaces that have virtual destructor without the other functions
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,128 @@
#
# SPDX-License-Identifier: Apache-2.0
# *******************************************************************************
load("@rules_cc//cc:defs.bzl", "cc_library")
load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test")

cc_library(
name = "component_task",
hdrs = ["component_task.hpp"],
include_prefix = "score/mw/launch_manager/process_group_manager/details",
strip_include_prefix = "/score/launch_manager/src/daemon/src/process_group_manager/details",
visibility = ["//score:__subpackages__"],
deps = [
":icomponent",
],
)

cc_library(
name = "icomponent_controller",
hdrs = ["icomponent_controller.hpp"],
include_prefix = "score/mw/launch_manager/process_group_manager/details",
strip_include_prefix = "/score/launch_manager/src/daemon/src/process_group_manager/details",
visibility = ["//score:__subpackages__"],
deps = [
":component_task",
":icomponent",
],
)

cc_library(
name = "icomponent",
hdrs = ["icomponent.hpp"],
include_prefix = "score/mw/launch_manager/process_group_manager/details",
strip_include_prefix = "/score/launch_manager/src/daemon/src/process_group_manager/details",
visibility = ["//score:__subpackages__"],
deps = [
"@score_baselibs//score/language/futurecpp",
],
)

cc_library(
name = "mock_component",
testonly = True,
hdrs = ["mock_component.hpp"],
include_prefix = "score/mw/launch_manager/process_group_manager/details",
strip_include_prefix = "/score/launch_manager/src/daemon/src/process_group_manager/details",
visibility = ["//score:__subpackages__"],
deps = [
":icomponent",
"@googletest//:gtest_main",
],
)

cc_library(
name = "mock_component_event_queue",
testonly = True,
hdrs = ["mock_component_event_queue.hpp"],
include_prefix = "score/mw/launch_manager/process_group_manager/details",
strip_include_prefix = "/score/launch_manager/src/daemon/src/process_group_manager/details",
visibility = ["//score:__subpackages__"],
deps = [
":icomponent_event_publisher_consumer",
"@googletest//:gtest_main",
],
)

cc_library(
name = "mock_termination_callback",
testonly = True,
hdrs = ["mock_termination_callback.hpp"],
include_prefix = "score/mw/launch_manager/process_group_manager/details",
strip_include_prefix = "/score/launch_manager/src/daemon/src/process_group_manager/details",
visibility = ["//score:__subpackages__"],
deps = [
":safe_process_map",
"@googletest//:gtest_main",
],
)

cc_library(
name = "component_event",
hdrs = ["component_event.hpp"],
include_prefix = "score/mw/launch_manager/process_group_manager/details",
strip_include_prefix = "/score/launch_manager/src/daemon/src/process_group_manager/details",
visibility = ["//score/launch_manager/src/daemon/src/process_group_manager:__pkg__"],
deps = [
":icomponent",
"//score/launch_manager/src/daemon/src/common:identifier_hash",
],
)

cc_library(
name = "component_event_queue",
hdrs = ["component_event_queue.hpp"],
include_prefix = "score/mw/launch_manager/process_group_manager/details",
strip_include_prefix = "/score/launch_manager/src/daemon/src/process_group_manager/details",
visibility = ["//score/launch_manager/src/daemon/src/process_group_manager:__pkg__"],
deps = [
":icomponent_event_publisher_consumer",
"//score/launch_manager/src/daemon/src/common:constants",
"//score/launch_manager/src/daemon/src/common:identifier_hash",
"//score/launch_manager/src/daemon/src/common/concurrency:mpsc_bounded_queue",
],
)

cc_library(
name = "icomponent_event_publisher_consumer",
hdrs = ["icomponent_event_publisher_consumer.hpp"],
include_prefix = "score/mw/launch_manager/process_group_manager/details",
strip_include_prefix = "/score/launch_manager/src/daemon/src/process_group_manager/details",
visibility = ["//score/launch_manager/src/daemon/src/process_group_manager:__pkg__"],
deps = [
":component_event",
"//score/launch_manager/src/daemon/src/common:constants",
"//score/launch_manager/src/daemon/src/common:identifier_hash",
],
)

cc_test(
name = "component_event_queue_UT",
srcs = ["component_event_queue_UT.cpp"],
deps = [
":component_event_queue",
"@googletest//:gtest_main",
],
)

cc_library(
name = "process_info_node",
Expand All @@ -23,6 +144,7 @@ cc_library(
strip_include_prefix = "/score/launch_manager/src/daemon/src/process_group_manager/details",
visibility = ["//score/launch_manager/src/daemon/src/process_group_manager:__pkg__"],
deps = [
":icomponent",
":safe_process_map",
"//score/launch_manager/src/daemon/src/control:control_client_channel",
"//score/launch_manager/src/daemon/src/osal:ipc_comms",
Expand All @@ -39,14 +161,28 @@ cc_library(
}),
)

cc_library(
name = "run_target",
hdrs = ["run_target.hpp"],
include_prefix = "score/mw/launch_manager/process_group_manager/details",
strip_include_prefix = "/score/launch_manager/src/daemon/src/process_group_manager/details",
visibility = ["//score/launch_manager/src/daemon/src/process_group_manager:__pkg__"],
deps = [
":icomponent",
],
)

cc_library(
name = "graph",
hdrs = ["graph.hpp"],
include_prefix = "score/mw/launch_manager/process_group_manager/details",
strip_include_prefix = "/score/launch_manager/src/daemon/src/process_group_manager/details",
visibility = ["//score/launch_manager/src/daemon/src/process_group_manager:__pkg__"],
deps = [
":component_event_queue",
":component_task",
":process_info_node",
":run_target",
":safe_process_map",
"//score/launch_manager/src/daemon/src/common:identifier_hash",
"//score/launch_manager/src/daemon/src/control:control_client_channel",
Expand All @@ -63,6 +199,7 @@ cc_library(
strip_include_prefix = "/score/launch_manager/src/daemon/src/process_group_manager/details",
visibility = ["//score/launch_manager/src/daemon/src/process_group_manager:__pkg__"],
deps = [
":icomponent_controller",
"//score/launch_manager/src/daemon/src/process_group_manager:iprocess",
],
)
Expand All @@ -72,6 +209,7 @@ cc_test(
timeout = "long",
srcs = ["safeprocessmap_UT.cpp"],
deps = [
":mock_termination_callback",
":safe_process_map",
"@googletest//:gtest_main",
],
Expand All @@ -92,10 +230,40 @@ cc_library(
],
)

cc_library(
name = "process_monitor",
srcs = ["process_monitor.cpp"],
hdrs = ["process_monitor.hpp"],
include_prefix = "score/mw/launch_manager/process_group_manager/details",
strip_include_prefix = "/score/launch_manager/src/daemon/src/process_group_manager/details",
visibility = ["//score/launch_manager/src/daemon/src/process_group_manager:__pkg__"],
deps = [
":graph",
":icomponent_controller",
":icomponent_event_publisher_consumer",
":os_handler",
":process_info_node",
":safe_process_map",
"//score/launch_manager/src/daemon/src/common:log",
],
)

cc_test(
name = "process_monitor_UT",
srcs = ["process_monitor_UT.cpp"],
deps = [
":mock_component",
":mock_component_event_queue",
":process_monitor",
"@googletest//:gtest_main",
],
)

cc_test(
name = "oshandler_UT",
srcs = ["oshandler_UT.cpp"],
deps = [
":mock_termination_callback",
":os_handler",
":safe_process_map",
"@googletest//:gtest_main",
Expand Down Expand Up @@ -135,10 +303,12 @@ cc_library(
}),
visibility = ["//score/launch_manager/src/daemon/src/process_group_manager:__pkg__"],
deps = [
":component_event_queue",
":graph",
":os_handler",
":process_info_node",
":process_launcher",
":process_monitor",
":safe_process_map",
"//score/launch_manager/src/daemon/src/common:log",
"//score/launch_manager/src/daemon/src/common/concurrency:mpmc_concurrent_queue",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/********************************************************************************
* Copyright (c) 2026 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_COMPONENT_EVENT_HPP_INCLUDED
#define SCORE_LCM_COMPONENT_EVENT_HPP_INCLUDED

#include <cstdint>
#include <variant>

#include "score/mw/launch_manager/common/identifier_hash.hpp"
#include "score/mw/launch_manager/process_group_manager/details/icomponent.hpp"

namespace score::mw::lifecycle::internal
{

using namespace score::lcm;

/// @brief A node finished activating successfully.
struct [[nodiscard]] ActivationSuccessful
{
uint32_t node_index;
};

/// @brief A node failed to activate.
struct [[nodiscard]] ActivationFailed
{
uint32_t node_index;
IComponent::ComponentError reason;
};

/// @brief A node finished deactivating.
struct [[nodiscard]] DeactivationComplete
{
uint32_t node_index;
};

/// @brief A node terminated without having been requested to.
struct [[nodiscard]] UnexpectedTermination
{
uint32_t node_index;
};

/// @brief Alive supervision has failed for the given process identifier.
struct [[nodiscard]] SupervisionFailure
{
IdentifierHash process_identifier;
};

/// @brief A graph-relevant state change. There is only ever a single graph, so no process-group
/// identifier is needed to route most events. SupervisionFailure is routed by process identifier.
using ComponentEvent = std::
variant<ActivationSuccessful, ActivationFailed, DeactivationComplete, UnexpectedTermination, SupervisionFailure>;

} // namespace score::mw::lifecycle::internal

#endif // SCORE_LCM_COMPONENT_EVENT_HPP_INCLUDED
Loading
Loading