diff --git a/MODERNIZATION.md b/MODERNIZATION.md index e922cc62..542edeb5 100644 --- a/MODERNIZATION.md +++ b/MODERNIZATION.md @@ -855,8 +855,60 @@ exactly that. So consolidation walks the dependency chain from the top: IMPROVED: clangd-tidy now runs on all 15 module units — full analysis coverage, zero suppressions. Verified: Release build, tn tests 12+1, proxyclient importer 15/15, standalone builds, lint - green. -3. C-3 streamr-dht (the largest) + green. **RETROFITTED in the C-3 PR to the settled architecture:** + partitions became named sub-modules (`streamr.trackerlessnetwork.X`), + the primary/umbrella unit was deleted, tests and the proxyclient + import the individual sub-modules they use, and the MessageRef + ordering operator moved from FifoMapWithTTL to the (exported) protos + module — as a non-exported file-scope function it had module linkage + and was unreachable from other modules instantiating the map + templates. One more sub-module gotcha found here: a purview forward + declaration of another module's class (NodeList forward-declared + ContentDeliveryRpcRemote) attaches the name to the WRONG module and + conflicts with the defining one — the import replaces it. +3. **C-3 streamr-dht** ✅ — the largest step, and where the module + ARCHITECTURE was settled through three owner directives measured + back to back: + **(i) One file per former header** — all 45 public headers + (5,013 lines) became per-header module units under `modules/` in the + old directory tree; include/ deleted. + **(ii) Named sub-modules, not partitions** (`streamr.dht.X`, not + `streamr.dht:X`): partitions cannot be imported by external + translation units, and the owner requires TESTS to import exactly + the sub-modules they test ("tests are internal to the module"). + All 41 dht test files import their subjects directly. + **(iii) NO umbrella module** — a `streamr.dht` unit re-exporting + all sub-modules was built and measured, then DELETED: its compiled + interface depends on every sub-module, so anyone importing it + reinherits the edit-anything-rebuild-everything amplification. + Downstream consumers (11 trackerless-network module units, its + integration test, the proxyclient implementation) import the + individual dht sub-modules they use — module imports now mirror the + old header includes one to one. THE MEASUREMENTS (same mid-chain / + leaf sub-module touch, whole-tree Release rebuild): partitions with + a re-exporting primary ~480 s; named sub-modules behind an umbrella + 418/546 s; **no umbrella 129/135 s**. The remaining cost is the true + dependency cone of central types plus the serial BMI chain; genuinely + narrow edits (tests, unimported leaves) rebuild in seconds. + Migration mechanics recorded for the remaining packages: sub-modules + are stricter about visibility than partitions — each unit must + DIRECTLY import what its code uses (the compiler names the missing + module explicitly: "declaration of 'X' must be imported from module + 'M'"), and shorthand names inherited textually from neighboring + headers need the file's own using-declaration. The include-hygiene + gotcha from C-2 recurred (`` for Branded-key containers ×16 + units, ``, ``, ``, folly `Collect.h`). + Incidental fixes: the dht standalone `install.sh` had hard-coded + `-fsanitize=address` into every configure (committed debugging + leftover, fatal once real code moved into module objects); removed. + PR #43's race fix (ReplayEventEmitter base of IPendingConnection) + ported into the sub-module during the rebase. One clangd-tidy + exclusion (ConnectionLockingTest.cpp, owner-approved selective + disabling — the analysis tool cannot resolve folly customization + points through module interfaces; the compiler accepts the file). + Verified: Release build, dht tests 83/83 (incl. the two new PR #43 + race tests), tn 12+1, proxyclient 15/15, standalone builds of the + whole chain, lint green over all module units. 4. C-4 streamr-proto-rpc 5. C-5 streamr-utils 6. C-6 streamr-logger @@ -868,6 +920,65 @@ One package per PR, `bench.sh` measured at the dht step and at the end per-package — the compiler itself enforces that nothing still includes them. +### `import std` verdict (investigated 2026-07-04, child session) +Owner-requested experiment on the consolidated trackerless-network +partition, with Android as the gate. Findings (full detail and a +working conversion template on the `experiment/import-std` branch, file +`import-std-findings.md` — NOT for merging): +- Host (Homebrew LLVM 22.1.8): works, including the mixed mode the + codebase needs (third-party textual includes + `import std;` purview). + The existing `STREAMR_IMPORT_STD` scaffold worked unmodified; one + toolchain packaging defect requires passing + `-DCMAKE_CXX_STDLIB_MODULES_JSON=$LLVM_PREFIX/lib/c++/libc++.modules.json`. +- **Android gate: FAILS for practical purposes.** NDK r29 is the first + NDK to ship the std module sources, but they do not compile against + Bionic as delivered (internal-linkage `ctype` inlines); making them + build requires overriding the undocumented `__BIONIC_CTYPE_INLINE` + macro, disabling `_FORTIFY_SOURCE` hardening, and hand-patching + CMake's cross-compilation stdlib detection. Not defensible. +- **Decision: do not adopt (not even host-only — it would fork the + source style).** Re-test each NDK release with the one-line probe in + the findings file; adopt when the NDK's sources compile cleanly with + fortify enabled AND CMake's detection passes the toolchain target. +- **NDK r30 beta 1 retest (owner-requested, 2026-07-04): still FAILS — + nothing gained by switching.** The blockers are in Bionic itself + (internal-linkage ctype functions AND the `_FORTIFY_SOURCE` stdio + wrappers, tested separately), textually unchanged in the pre-release. + One improvement found during the retest: CMake's broken + cross-compilation standard-library probe can be bypassed CLEANLY by + adding the Android `--target` to `CMAKE_CXX_FLAGS` (replaces the + indefensible hand-patching of generated files). The full minimal + adoption recipe for a future fixed NDK is recorded in + `import-std-findings.md` on the `experiment/import-std` branch; the + probe must include `-D_FORTIFY_SOURCE=2` or the second failure stays + hidden. + +### After the consolidation: CI speed (owner-approved, 2026-07-04) +Even with the per-platform dependency caches fixed (Android ~30 → 9.6 +min, iOS ~35 → 4.6 min), each CI job still compiles the monorepo from +scratch and runs the tests serially. Planned follow-up work, in payoff +order — scheduled AFTER C-8 because every consolidation step changes +the build structure the caches would key on: +1. **Stop compiling the monorepo twice per job.** `install.sh` builds + every package standalone AND then the whole root tree. The + standalone-package check validates packaging structure, which does + not differ per platform — run it on ONE platform (macOS) only. +2. **Cache the build directories per platform** (with restore-keys + fallbacks, like the dependency caches). Ninja then recompiles only + what a pull request touches — and the one-partition-per-header + structure is exactly what keeps the rebuild cascade small: editing + one partition rebuilds that partition, its importers and the links, + not whole packages. Watch the shared 10 GB actions-cache budget; + if build trees + five dependency caches start evicting each other, + move the dependency cache to a GitHub Packages NuGet feed + (documented option from the cache investigation, free for public + repositories) to reclaim the budget. +3. **ccache as a complement** if build-dir caching proves fragile: + caches ordinary TUs (all test files — the bulk) but not module + BMI compiles (tooling support still poor). +4. **Randomize test ports, then run ctest in parallel** — tests + currently use fixed ports and must run serially. + ### Interim posture (adopted now) The façade stage is COMPLETE and delivers: uniform `import streamr.` consumption, −24% clean builds, 250+ tests through import, and module diff --git a/cmake/StreamrModules.cmake b/cmake/StreamrModules.cmake index 2bb5f1e6..04160292 100644 --- a/cmake/StreamrModules.cmake +++ b/cmake/StreamrModules.cmake @@ -120,6 +120,13 @@ function(streamr_add_module_library TARGET) # undeclared). Making the flag part of the PUBLIC interface keeps the # BMI and every importer consistent. No-op on other platforms. target_compile_options(${TARGET} PUBLIC $<$:-pthread>) + # The module libraries' objects end up inside the shared + # libstreamrproxyclient, so they must be position-independent. macOS + # emits PIC by default; on Linux the ELF linker rejects the archive + # otherwise ("recompile with -fPIC" against the module vtable/thunk + # symbols — first seen when the consolidated code moved into module + # objects on the linux-arm64 leg). + set_target_properties(${TARGET} PROPERTIES POSITION_INDEPENDENT_CODE ON) endfunction() # streamr_target_module_sources( FILES ...) @@ -143,8 +150,10 @@ function(streamr_target_module_sources TARGET) FILES ${ARG_FILES}) set_target_properties(${TARGET} PROPERTIES CXX_SCAN_FOR_MODULES ON) target_compile_features(${TARGET} PUBLIC cxx_std_26) - # See streamr_add_module_library: BMI/importer -pthread consistency. + # See streamr_add_module_library: BMI/importer -pthread consistency + # and position independence for the shared-library link. target_compile_options(${TARGET} PUBLIC $<$:-pthread>) + set_target_properties(${TARGET} PROPERTIES POSITION_INDEPENDENT_CODE ON) endfunction() # streamr_enable_imports() diff --git a/packages/streamr-dht/CMakeLists.txt b/packages/streamr-dht/CMakeLists.txt index b6f5aca0..9c2adde3 100644 --- a/packages/streamr-dht/CMakeLists.txt +++ b/packages/streamr-dht/CMakeLists.txt @@ -47,14 +47,17 @@ add_library(streamr-dht) set_property(TARGET streamr-dht PROPERTY CXX_STANDARD 26) add_library(streamr::streamr-dht ALIAS streamr-dht) -# Module façade (MODERNIZATION.md Part 2): 45 partitions mirroring the -# header tree + :protos over the generated DhtRpc trio. -file(GLOB STREAMR_DHT_MODULE_UNITS CONFIGURE_DEPENDS +# CONSOLIDATED (MODERNIZATION.md Phase 2.6): one partition per former +# public header, in the same directory tree the headers had (the +# partition files are the source of truth), plus :protos over the +# generated DhtRpc trio and the primary interface unit that re-exports +# every partition. +file(GLOB_RECURSE STREAMR_DHT_MODULE_UNITS CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/modules/*.cppm) streamr_target_module_sources(streamr-dht FILES ${STREAMR_DHT_MODULE_UNITS}) -target_include_directories(streamr-dht - PUBLIC $ - PUBLIC $ +# Only the generated protobuf code remains a header consumers may need +# textually. +target_include_directories(streamr-dht PUBLIC $ ) diff --git a/packages/streamr-dht/StreamrModules.cmake b/packages/streamr-dht/StreamrModules.cmake index 2bb5f1e6..04160292 100644 --- a/packages/streamr-dht/StreamrModules.cmake +++ b/packages/streamr-dht/StreamrModules.cmake @@ -120,6 +120,13 @@ function(streamr_add_module_library TARGET) # undeclared). Making the flag part of the PUBLIC interface keeps the # BMI and every importer consistent. No-op on other platforms. target_compile_options(${TARGET} PUBLIC $<$:-pthread>) + # The module libraries' objects end up inside the shared + # libstreamrproxyclient, so they must be position-independent. macOS + # emits PIC by default; on Linux the ELF linker rejects the archive + # otherwise ("recompile with -fPIC" against the module vtable/thunk + # symbols — first seen when the consolidated code moved into module + # objects on the linux-arm64 leg). + set_target_properties(${TARGET} PROPERTIES POSITION_INDEPENDENT_CODE ON) endfunction() # streamr_target_module_sources( FILES ...) @@ -143,8 +150,10 @@ function(streamr_target_module_sources TARGET) FILES ${ARG_FILES}) set_target_properties(${TARGET} PROPERTIES CXX_SCAN_FOR_MODULES ON) target_compile_features(${TARGET} PUBLIC cxx_std_26) - # See streamr_add_module_library: BMI/importer -pthread consistency. + # See streamr_add_module_library: BMI/importer -pthread consistency + # and position independence for the shared-library link. target_compile_options(${TARGET} PUBLIC $<$:-pthread>) + set_target_properties(${TARGET} PROPERTIES POSITION_INDEPENDENT_CODE ON) endfunction() # streamr_enable_imports() diff --git a/packages/streamr-dht/include/streamr-dht/types/NatType.hpp b/packages/streamr-dht/include/streamr-dht/types/NatType.hpp deleted file mode 100644 index 06bd452d..00000000 --- a/packages/streamr-dht/include/streamr-dht/types/NatType.hpp +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef STREAMR_DHT_TYPES_NAT_TYPE_HPP -#define STREAMR_DHT_TYPES_NAT_TYPE_HPP - -// NOLINTBEGIN -namespace streamr::dht::types::NatType { - -inline constexpr auto OPEN_INTERNET = "open_internet"; -inline constexpr auto UNKNOWN = "unknown"; - -} // namespace streamr::dht::types::NatType -// NOLINTEND - -#endif \ No newline at end of file diff --git a/packages/streamr-dht/include/streamr-dht/types/PortRange.hpp b/packages/streamr-dht/include/streamr-dht/types/PortRange.hpp deleted file mode 100644 index 164c3030..00000000 --- a/packages/streamr-dht/include/streamr-dht/types/PortRange.hpp +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef STREAMR_DHT_TYPES_PORTRANGE_HPP -#define STREAMR_DHT_TYPES_PORTRANGE_HPP - -#include - -namespace streamr::dht::types { - -struct PortRange { - uint16_t min; - uint16_t max; -}; - -} // namespace streamr::dht::types - -#endif // STREAMR_DHT_TYPES_PORTRANGE_HPP diff --git a/packages/streamr-dht/include/streamr-dht/types/TlsCertificateFiles.hpp b/packages/streamr-dht/include/streamr-dht/types/TlsCertificateFiles.hpp deleted file mode 100644 index 14b3733b..00000000 --- a/packages/streamr-dht/include/streamr-dht/types/TlsCertificateFiles.hpp +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef STREAMR_DHT_TYPES_TLSCERTIFICATEFILES_HPP -#define STREAMR_DHT_TYPES_TLSCERTIFICATEFILES_HPP - -#include - -namespace streamr::dht::types { - -struct TlsCertificateFiles { - std::string privateKeyFileName; - std::string certFileName; -}; - -} // namespace streamr::dht::types - -#endif // STREAMR_DHT_TYPES_TLSCERTIFICATEFILES_HPP \ No newline at end of file diff --git a/packages/streamr-dht/install.sh b/packages/streamr-dht/install.sh index d7952867..5e35dec0 100755 --- a/packages/streamr-dht/install.sh +++ b/packages/streamr-dht/install.sh @@ -31,12 +31,18 @@ if [ -n "$TARGET_TRIPLET" ]; then echo "Target platform: $TARGET_TRIPLET" fi +# NOTE: this script used to hard-code -fsanitize=address into every +# configure (a committed debugging leftover). That silently produced a +# sanitizer-instrumented standalone archive which, once the package's +# real code moved into the module units (Phase 2.6 consolidation), +# broke every downstream standalone link with undefined ___asan_* +# symbols. Sanitized builds should be an explicit opt-in instead. if [ -n "$TARGET_TRIPLET" ]; then if [ "$TARGET_TRIPLET" = "arm64-android" ]; then - cd build && cmake -DCMAKE_CXX_FLAGS="-fsanitize=address -fno-omit-frame-pointer" -DCMAKE_EXE_LINKER_FLAGS="-fsanitize=address" -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DVCPKG_TARGET_TRIPLET=$TARGET_TRIPLET -DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=$CHAINLOAD_TOOLCHAIN_FILE -DANDROID_ABI=$ANDROID_ABI -DANDROID_PLATFORM=$ANDROID_PLATFORM .. && cmake --build . && cd .. + cd build && cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DVCPKG_TARGET_TRIPLET=$TARGET_TRIPLET -DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=$CHAINLOAD_TOOLCHAIN_FILE -DANDROID_ABI=$ANDROID_ABI -DANDROID_PLATFORM=$ANDROID_PLATFORM .. && cmake --build . && cd .. else - cd build && cmake -DCMAKE_CXX_FLAGS="-fsanitize=address -fno-omit-frame-pointer" -DCMAKE_EXE_LINKER_FLAGS="-fsanitize=address" -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DVCPKG_TARGET_TRIPLET=$TARGET_TRIPLET -DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=$CHAINLOAD_TOOLCHAIN_FILE -DPLATFORM=$PLATFORM .. && cmake --build . && cd .. + cd build && cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DVCPKG_TARGET_TRIPLET=$TARGET_TRIPLET -DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=$CHAINLOAD_TOOLCHAIN_FILE -DPLATFORM=$PLATFORM .. && cmake --build . && cd .. fi else - cd build && cmake -DCMAKE_CXX_FLAGS="-fsanitize=address -fno-omit-frame-pointer" -DCMAKE_EXE_LINKER_FLAGS="-fsanitize=address" -DCMAKE_BUILD_TYPE=$BUILD_TYPE .. && cmake --build . && cd .. + cd build && cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE .. && cmake --build . && cd .. fi diff --git a/packages/streamr-dht/lint.sh b/packages/streamr-dht/lint.sh index c9e9372e..739ec944 100755 --- a/packages/streamr-dht/lint.sh +++ b/packages/streamr-dht/lint.sh @@ -5,16 +5,27 @@ set -e FILES=$(find . -type d \( -name src -o -name test -o -name include \) ! -path '*/build/*' ! -path '*/proto/*' -print0 | xargs -0 -I{} find {} -type f \( -name "*.hpp" -o -name "*.cpp" \) -print0 | xargs -0 echo) echo "Running clangd-tidy on $FILES" -clangd-tidy -p ./build $FILES +# ConnectionLockingTest.cpp is excluded from clangd-tidy (owner-approved +# selective disabling, Phase 2.6 consolidation): it instantiates the +# imported streamr::utils::collect, whose folly internals clangd cannot +# resolve through module interfaces (spurious WithAsyncStackFunction +# error). The COMPILER accepts the file; clang-format still checks it. +TIDY_FILES=$(echo "$FILES" | tr ' ' '\n' | grep -v 'test/integration/ConnectionLockingTest.cpp' | tr '\n' ' ') +clangd-tidy -p ./build $TIDY_FILES echo "Running clang-format --dry-run on $FILES" ../../run-clang-format.py $FILES -# Module interface units: format check only. clangd-tidy is not run on -# .cppm files (headers remain the fully linted source of truth during the -# façade migration; clangd modules support is still experimental). +# CONSOLIDATED (MODERNIZATION.md Phase 2.6): the include/ tree is gone — +# the code lives in the module interface units, which are linted with +# clangd-tidy as the source of truth (the consolidated units carry no +# export-using re-export blocks, which caused the earlier clangd false +# positives). MODULE_FILES=$(find ./modules -type f -name "*.cppm" 2>/dev/null | xargs echo) if [ -n "$MODULE_FILES" ]; then + echo "Running clangd-tidy on $MODULE_FILES" + clangd-tidy -p ./build $MODULE_FILES + echo "Running clang-format --dry-run on $MODULE_FILES" ../../run-clang-format.py $MODULE_FILES fi diff --git a/packages/streamr-dht/include/streamr-dht/Identifiers.hpp b/packages/streamr-dht/modules/Identifiers.cppm similarity index 78% rename from packages/streamr-dht/include/streamr-dht/Identifiers.hpp rename to packages/streamr-dht/modules/Identifiers.cppm index 2d8e9a9b..f086d0bc 100644 --- a/packages/streamr-dht/include/streamr-dht/Identifiers.hpp +++ b/packages/streamr-dht/modules/Identifiers.cppm @@ -1,15 +1,22 @@ -#ifndef STREAMR_DHT_IDENTIFIERS_HPP -#define STREAMR_DHT_IDENTIFIERS_HPP +// Module streamr.dht.Identifiers +// CONSOLIDATED from the former header streamr-dht/Identifiers.hpp +// (MODERNIZATION.md Phase 2.6): this file is now the source of truth. +module; #include #include #include #include "packages/dht/protos/DhtRpc.pb.h" -#include "streamr-utils/BinaryUtils.hpp" -#include "streamr-utils/Branded.hpp" -namespace streamr::dht { +export module streamr.dht.Identifiers; + +import streamr.utils; + +// Hoisted from the former header (file scope, NOT exported); +// fully qualified: relative namespace names resolve differently +// at file scope than inside the package namespace. using streamr::utils::BinaryUtils; +export namespace streamr::dht { using DhtAddress = streamr::utils::Branded; using DhtAddressRaw = @@ -52,5 +59,3 @@ struct Identifiers { } }; } // namespace streamr::dht - -#endif // STREAMR_DHT_IDENTIFIERS_HPP \ No newline at end of file diff --git a/packages/streamr-dht/include/streamr-dht/connection/Connection.hpp b/packages/streamr-dht/modules/connection/Connection.cppm similarity index 77% rename from packages/streamr-dht/include/streamr-dht/connection/Connection.hpp rename to packages/streamr-dht/modules/connection/Connection.cppm index c80ce2d5..5ac16095 100644 --- a/packages/streamr-dht/include/streamr-dht/connection/Connection.hpp +++ b/packages/streamr-dht/modules/connection/Connection.cppm @@ -1,22 +1,32 @@ -#ifndef STREAMR_DHT_CONNECTION_CONNECTION_HPP -#define STREAMR_DHT_CONNECTION_CONNECTION_HPP +// Module streamr.dht.Connection +// CONSOLIDATED from the former header streamr-dht/connection/Connection.hpp +// (MODERNIZATION.md Phase 2.6): this file is now the source of truth. +module; #include #include #include #include #include -#include "streamr-eventemitter/EventEmitter.hpp" -#include "streamr-logger/SLogger.hpp" -#include "streamr-utils/Branded.hpp" -#include "streamr-utils/Uuid.hpp" -namespace streamr::dht::connection { +#include + +export module streamr.dht.Connection; + +import streamr.eventemitter; +import streamr.logger; +import streamr.utils; + +// Hoisted from the former header (file scope, NOT exported); +// fully qualified: relative namespace names resolve differently +// at file scope than inside the package namespace. using streamr::eventemitter::Event; using streamr::eventemitter::EventEmitter; using streamr::logger::SLogger; using streamr::utils::Branded; using streamr::utils::Uuid; +export namespace streamr::dht::connection { + using ConnectionID = Branded; using Url = Branded; @@ -75,5 +85,3 @@ class Connection : public EventEmitter { }; } // namespace streamr::dht::connection - -#endif // STREAMR_DHT_CONNECTION_CONNECTION_HPP \ No newline at end of file diff --git a/packages/streamr-dht/include/streamr-dht/connection/ConnectionLockRpcLocal.hpp b/packages/streamr-dht/modules/connection/ConnectionLockRpcLocal.cppm similarity index 82% rename from packages/streamr-dht/include/streamr-dht/connection/ConnectionLockRpcLocal.hpp rename to packages/streamr-dht/modules/connection/ConnectionLockRpcLocal.cppm index a4e79860..ed27e2f3 100644 --- a/packages/streamr-dht/include/streamr-dht/connection/ConnectionLockRpcLocal.hpp +++ b/packages/streamr-dht/modules/connection/ConnectionLockRpcLocal.cppm @@ -1,15 +1,28 @@ -#ifndef STREAMR_DHT_CONNECTION_CONNECTIONLOCKRPCLOCAL_HPP -#define STREAMR_DHT_CONNECTION_CONNECTIONLOCKRPCLOCAL_HPP +// Module streamr.dht.ConnectionLockRpcLocal +// CONSOLIDATED from the former header +// streamr-dht/connection/ConnectionLockRpcLocal.hpp (MODERNIZATION.md +// Phase 2.6): this file is now the source of truth. +module; #include #include #include "packages/dht/protos/DhtRpc.pb.h" #include "packages/dht/protos/DhtRpc.server.pb.h" -#include "streamr-dht/Identifiers.hpp" -#include "streamr-dht/connection/ConnectionLockStates.hpp" -#include "streamr-dht/rpc-protocol/DhtCallContext.hpp" -#include "streamr-logger/SLogger.hpp" -namespace streamr::dht::connection { + +#include + +export module streamr.dht.ConnectionLockRpcLocal; + +import streamr.logger; +import streamr.dht.ConnectionLockStates; +import streamr.dht.DhtCallContext; +import streamr.dht.Identifiers; + +// Hoisted from the former header (file scope, NOT exported); +// fully qualified: relative namespace names resolve differently +// at file scope than inside the package namespace. +using streamr::logger::SLogger; +export namespace streamr::dht::connection { using ::dht::ConnectionLockRpc; using ::dht::DisconnectMode; @@ -19,7 +32,6 @@ using ::dht::LockResponse; using ::dht::PeerDescriptor; using ::dht::UnlockRequest; using streamr::dht::rpcprotocol::DhtCallContext; -using streamr::logger::SLogger; struct ConnectionLockRpcLocalOptions { std::function addRemoteLocked; @@ -93,5 +105,3 @@ class ConnectionLockRpcLocal : public ConnectionLockRpc { }; } // namespace streamr::dht::connection - -#endif // STREAMR_DHT_CONNECTION_CONNECTIONLOCKRPCLOCAL_HPP \ No newline at end of file diff --git a/packages/streamr-dht/include/streamr-dht/connection/ConnectionLockRpcRemote.hpp b/packages/streamr-dht/modules/connection/ConnectionLockRpcRemote.cppm similarity index 83% rename from packages/streamr-dht/include/streamr-dht/connection/ConnectionLockRpcRemote.hpp rename to packages/streamr-dht/modules/connection/ConnectionLockRpcRemote.cppm index 53efb647..9071c5d3 100644 --- a/packages/streamr-dht/include/streamr-dht/connection/ConnectionLockRpcRemote.hpp +++ b/packages/streamr-dht/modules/connection/ConnectionLockRpcRemote.cppm @@ -1,18 +1,30 @@ -#ifndef STREAMR_DHT_CONNECTION_CONNECTIONLOCKRPCREMOTE_HPP -#define STREAMR_DHT_CONNECTION_CONNECTIONLOCKRPCREMOTE_HPP +// Module streamr.dht.ConnectionLockRpcRemote +// CONSOLIDATED from the former header +// streamr-dht/connection/ConnectionLockRpcRemote.hpp (MODERNIZATION.md +// Phase 2.6): this file is now the source of truth. +module; #include #include #include #include "packages/dht/protos/DhtRpc.client.pb.h" #include "packages/dht/protos/DhtRpc.pb.h" -#include "streamr-dht/Identifiers.hpp" -#include "streamr-dht/connection/ConnectionLockStates.hpp" -#include "streamr-dht/dht/contact/RpcRemote.hpp" -#include "streamr-dht/rpc-protocol/DhtCallContext.hpp" -#include "streamr-logger/SLogger.hpp" -namespace streamr::dht::connection { +#include + +export module streamr.dht.ConnectionLockRpcRemote; + +import streamr.logger; +import streamr.dht.ConnectionLockStates; +import streamr.dht.DhtCallContext; +import streamr.dht.Identifiers; +import streamr.dht.RpcRemote; + +// Hoisted from the former header (file scope, NOT exported); +// fully qualified: relative namespace names resolve differently +// at file scope than inside the package namespace. +using streamr::logger::SLogger; +export namespace streamr::dht::connection { using streamr::dht::rpcprotocol::DhtCallContext; using ConnectionLockRpcClient = ::dht::ConnectionLockRpcClient; @@ -24,7 +36,6 @@ using ::dht::UnlockRequest; using streamr::dht::connection::LockID; using streamr::dht::contact::RpcRemote; using streamr::dht::rpcprotocol::DhtCallContext; -using streamr::logger::SLogger; class ConnectionLockRpcRemote : public RpcRemote { public: @@ -100,5 +111,3 @@ class ConnectionLockRpcRemote : public RpcRemote { }; } // namespace streamr::dht::connection - -#endif \ No newline at end of file diff --git a/packages/streamr-dht/include/streamr-dht/connection/ConnectionLockStates.hpp b/packages/streamr-dht/modules/connection/ConnectionLockStates.cppm similarity index 92% rename from packages/streamr-dht/include/streamr-dht/connection/ConnectionLockStates.hpp rename to packages/streamr-dht/modules/connection/ConnectionLockStates.cppm index bb436e0b..c10f0172 100644 --- a/packages/streamr-dht/include/streamr-dht/connection/ConnectionLockStates.hpp +++ b/packages/streamr-dht/modules/connection/ConnectionLockStates.cppm @@ -1,13 +1,20 @@ -#ifndef STREAMR_DHT_CONNECTION_CONNECTIONLOCKSTATES_HPP -#define STREAMR_DHT_CONNECTION_CONNECTIONLOCKSTATES_HPP +// Module streamr.dht.ConnectionLockStates +// CONSOLIDATED from the former header +// streamr-dht/connection/ConnectionLockStates.hpp (MODERNIZATION.md Phase 2.6): +// this file is now the source of truth. +module; #include #include #include -#include "streamr-dht/Identifiers.hpp" -#include "streamr-utils/Branded.hpp" -namespace streamr::dht::connection { +#include + +export module streamr.dht.ConnectionLockStates; + +import streamr.utils; +import streamr.dht.Identifiers; +export namespace streamr::dht::connection { using DhtAddress = streamr::dht::DhtAddress; using LockID = streamr::utils::Branded; @@ -152,5 +159,3 @@ class ConnectionLockStates { }; } // namespace streamr::dht::connection - -#endif // STREAMR_DHT_CONNECTION_CONNECTIONLOCKSTATES_HPP \ No newline at end of file diff --git a/packages/streamr-dht/include/streamr-dht/connection/ConnectionLocker.hpp b/packages/streamr-dht/modules/connection/ConnectionLocker.cppm similarity index 71% rename from packages/streamr-dht/include/streamr-dht/connection/ConnectionLocker.hpp rename to packages/streamr-dht/modules/connection/ConnectionLocker.cppm index 4ebcbd5f..6bbb208a 100644 --- a/packages/streamr-dht/include/streamr-dht/connection/ConnectionLocker.hpp +++ b/packages/streamr-dht/modules/connection/ConnectionLocker.cppm @@ -1,12 +1,19 @@ -#ifndef STREAMR_DHT_CONNECTION_CONNECTIONLOCKER_HPP -#define STREAMR_DHT_CONNECTION_CONNECTIONLOCKER_HPP +// Module streamr.dht.ConnectionLocker +// CONSOLIDATED from the former header +// streamr-dht/connection/ConnectionLocker.hpp (MODERNIZATION.md Phase 2.6): +// this file is now the source of truth. +module; #include #include "packages/dht/protos/DhtRpc.pb.h" -#include "streamr-dht/Identifiers.hpp" -#include "streamr-dht/connection/ConnectionLockStates.hpp" -namespace streamr::dht::connection { +#include + +export module streamr.dht.ConnectionLocker; + +import streamr.dht.ConnectionLockStates; +import streamr.dht.Identifiers; +export namespace streamr::dht::connection { using ::dht::PeerDescriptor; using streamr::dht::DhtAddress; @@ -32,5 +39,3 @@ class ConnectionLocker { }; } // namespace streamr::dht::connection - -#endif // STREAMR_DHT_CONNECTION_CONNECTIONLOCKER_HPP \ No newline at end of file diff --git a/packages/streamr-dht/include/streamr-dht/connection/ConnectionManager.hpp b/packages/streamr-dht/modules/connection/ConnectionManager.cppm similarity index 96% rename from packages/streamr-dht/include/streamr-dht/connection/ConnectionManager.hpp rename to packages/streamr-dht/modules/connection/ConnectionManager.cppm index a88d7fab..312fa81c 100644 --- a/packages/streamr-dht/include/streamr-dht/connection/ConnectionManager.hpp +++ b/packages/streamr-dht/modules/connection/ConnectionManager.cppm @@ -1,5 +1,8 @@ -#ifndef STREAMR_DHT_CONNECTION_CONNECTIONMANAGER_HPP -#define STREAMR_DHT_CONNECTION_CONNECTIONMANAGER_HPP +// Module streamr.dht.ConnectionManager +// CONSOLIDATED from the former header +// streamr-dht/connection/ConnectionManager.hpp (MODERNIZATION.md Phase 2.6): +// this file is now the source of truth. +module; #include #include @@ -9,21 +12,38 @@ #include #include #include "packages/dht/protos/DhtRpc.pb.h" -#include "streamr-dht/Identifiers.hpp" -#include "streamr-dht/connection/ConnectionLockRpcLocal.hpp" -#include "streamr-dht/connection/ConnectionLockRpcRemote.hpp" -#include "streamr-dht/connection/ConnectionLocker.hpp" -#include "streamr-dht/connection/ConnectionsView.hpp" -#include "streamr-dht/connection/ConnectorFacade.hpp" -#include "streamr-dht/connection/endpoint/Endpoint.hpp" -#include "streamr-dht/dht/routing/DuplicateDetector.hpp" -#include "streamr-dht/helpers/Errors.hpp" -#include "streamr-dht/helpers/Offerer.hpp" -#include "streamr-dht/transport/RoutingRpcCommunicator.hpp" -#include "streamr-dht/transport/Transport.hpp" -#include "streamr-logger/SLogger.hpp" -#include "streamr-utils/waitForEvent.hpp" -namespace streamr::dht::connection { + +#include + +#include + +export module streamr.dht.ConnectionManager; + +import streamr.protorpc; +import streamr.dht.ConnectionLockStates; +import streamr.logger; +import streamr.utils; +import streamr.dht.ConnectionLockRpcLocal; +import streamr.dht.ConnectionLockRpcRemote; +import streamr.dht.ConnectionLocker; +import streamr.dht.ConnectionsView; +import streamr.dht.ConnectorFacade; +import streamr.dht.DuplicateDetector; +import streamr.dht.Endpoint; +import streamr.dht.Errors; +import streamr.dht.Identifiers; +import streamr.dht.Offerer; +import streamr.dht.RoutingRpcCommunicator; +import streamr.dht.Transport; + +// Hoisted from the former header (file scope, NOT exported); +// fully qualified: relative namespace names resolve differently +// at file scope than inside the package namespace. +using streamr::logger::SLogger; +using streamr::protorpc::RpcCommunicatorOptions; +using streamr::utils::waitForEvent; + +export namespace streamr::dht::connection { using ::dht::LockRequest; using ::dht::LockResponse; @@ -46,8 +66,6 @@ using streamr::dht::transport::RoutingRpcCommunicator; using streamr::dht::transport::SendOptions; using streamr::dht::transport::Transport; using streamr::dht::transport::transportevents::Disconnected; -using streamr::logger::SLogger; -using streamr::utils::waitForEvent; namespace endpointevents = streamr::dht::connection::endpoint::endpointevents; @@ -717,4 +735,3 @@ class ConnectionManager : public Transport, }; } // namespace streamr::dht::connection -#endif // STREAMR_DHT_CONNECTION_CONNECTIONMANAGER_HPP \ No newline at end of file diff --git a/packages/streamr-dht/include/streamr-dht/connection/ConnectionsView.hpp b/packages/streamr-dht/modules/connection/ConnectionsView.cppm similarity index 57% rename from packages/streamr-dht/include/streamr-dht/connection/ConnectionsView.hpp rename to packages/streamr-dht/modules/connection/ConnectionsView.cppm index 7a496f8d..a4687df6 100644 --- a/packages/streamr-dht/include/streamr-dht/connection/ConnectionsView.hpp +++ b/packages/streamr-dht/modules/connection/ConnectionsView.cppm @@ -1,10 +1,17 @@ -#ifndef STREAMR_DHT_CONNECTION_CONNECTIONSVIEW_HPP -#define STREAMR_DHT_CONNECTION_CONNECTIONSVIEW_HPP +// Module streamr.dht.ConnectionsView +// CONSOLIDATED from the former header +// streamr-dht/connection/ConnectionsView.hpp (MODERNIZATION.md Phase 2.6): this +// file is now the source of truth. +module; #include "packages/dht/protos/DhtRpc.pb.h" -#include "streamr-dht/Identifiers.hpp" -namespace streamr::dht::connection { +#include + +export module streamr.dht.ConnectionsView; + +import streamr.dht.Identifiers; +export namespace streamr::dht::connection { using ::dht::PeerDescriptor; @@ -21,5 +28,3 @@ class ConnectionsView { }; } // namespace streamr::dht::connection - -#endif // STREAMR_DHT_CONNECTION_CONNECTIONSVIEW_HPP \ No newline at end of file diff --git a/packages/streamr-dht/include/streamr-dht/connection/ConnectorFacade.hpp b/packages/streamr-dht/modules/connection/ConnectorFacade.cppm similarity index 89% rename from packages/streamr-dht/include/streamr-dht/connection/ConnectorFacade.hpp rename to packages/streamr-dht/modules/connection/ConnectorFacade.cppm index 7e3a1221..127cb764 100644 --- a/packages/streamr-dht/include/streamr-dht/connection/ConnectorFacade.hpp +++ b/packages/streamr-dht/modules/connection/ConnectorFacade.cppm @@ -1,23 +1,39 @@ -#ifndef STREAMR_DHT_CONNECTION_CONNECTORFACADE_HPP -#define STREAMR_DHT_CONNECTION_CONNECTORFACADE_HPP +// Module streamr.dht.ConnectorFacade +// CONSOLIDATED from the former header +// streamr-dht/connection/ConnectorFacade.hpp (MODERNIZATION.md Phase 2.6): this +// file is now the source of truth. +module; #include #include #include "packages/dht/protos/DhtRpc.pb.h" -#include "streamr-dht/connection/IPendingConnection.hpp" -#include "streamr-dht/connection/PendingConnection.hpp" -#include "streamr-dht/connection/websocket/WebsocketClientConnector.hpp" -#include "streamr-dht/connection/websocket/WebsocketServerConnector.hpp" -#include "streamr-dht/transport/ListeningRpcCommunicator.hpp" -#include "streamr-dht/transport/Transport.hpp" -#include "streamr-dht/types/PortRange.hpp" -#include "streamr-proto-rpc/RpcCommunicator.hpp" -namespace streamr::dht::connection { +#include + +export module streamr.dht.ConnectorFacade; + +import streamr.dht.Identifiers; +import streamr.logger; +import streamr.protorpc; +import streamr.dht.IPendingConnection; +import streamr.dht.ListeningRpcCommunicator; +import streamr.dht.PendingConnection; +import streamr.dht.PortRange; +import streamr.dht.Transport; +import streamr.dht.WebsocketClientConnector; +import streamr.dht.WebsocketServerConnector; + +// Hoisted from the former header (file scope, NOT exported); +// fully qualified: relative namespace names resolve differently +// at file scope than inside the package namespace. +using std::chrono::milliseconds; +using streamr::logger::SLogger; +using streamr::protorpc::RpcCommunicatorOptions; + +export namespace streamr::dht::connection { using namespace std::chrono_literals; using ::dht::ConnectivityResponse; -using std::chrono::milliseconds; using streamr::dht::connection::IPendingConnection; using streamr::dht::connection::PendingConnection; using streamr::dht::connection::websocket::WebsocketClientConnector; @@ -27,7 +43,6 @@ using streamr::dht::connection::websocket::WebsocketServerConnectorOptions; using streamr::dht::transport::ListeningRpcCommunicator; using streamr::dht::transport::Transport; using streamr::dht::types::PortRange; -using streamr::protorpc::RpcCommunicatorOptions; class ConnectorFacade { protected: @@ -185,5 +200,3 @@ class DefaultConnectorFacade : public ConnectorFacade { }; } // namespace streamr::dht::connection - -#endif // STREAMR_DHT_CONNECTION_CONNECTORFACADE_HPP diff --git a/packages/streamr-dht/include/streamr-dht/connection/Handshaker.hpp b/packages/streamr-dht/modules/connection/Handshaker.cppm similarity index 91% rename from packages/streamr-dht/include/streamr-dht/connection/Handshaker.hpp rename to packages/streamr-dht/modules/connection/Handshaker.cppm index 1e35c765..95a8e803 100644 --- a/packages/streamr-dht/include/streamr-dht/connection/Handshaker.hpp +++ b/packages/streamr-dht/modules/connection/Handshaker.cppm @@ -1,18 +1,30 @@ -#ifndef STREAMR_DHT_CONNECTION_HANDSHAKER_HPP -#define STREAMR_DHT_CONNECTION_HANDSHAKER_HPP +// Module streamr.dht.Handshaker +// CONSOLIDATED from the former header streamr-dht/connection/Handshaker.hpp +// (MODERNIZATION.md Phase 2.6): this file is now the source of truth. +module; #include #include #include #include "packages/dht/protos/DhtRpc.pb.h" -#include "streamr-dht/connection/Connection.hpp" -#include "streamr-dht/helpers/Version.hpp" -#include "streamr-eventemitter/EventEmitter.hpp" -#include "streamr-logger/SLogger.hpp" -#include "streamr-utils/EnableSharedFromThis.hpp" -#include "streamr-utils/Uuid.hpp" -namespace streamr::dht::connection { +export module streamr.dht.Handshaker; + +import streamr.eventemitter; +import streamr.logger; +import streamr.utils; +import streamr.dht.Connection; +import streamr.dht.Version; + +// Hoisted from the former header (file scope, NOT exported); +// fully qualified: relative namespace names resolve differently +// at file scope than inside the package namespace. +using streamr::eventemitter::Event; +using streamr::eventemitter::EventEmitter; +using streamr::logger::SLogger; +using streamr::utils::EnableSharedFromThis; +using streamr::utils::Uuid; +export namespace streamr::dht::connection { using ::dht::HandshakeError; using ::dht::HandshakeRequest; @@ -22,11 +34,6 @@ using ::dht::PeerDescriptor; using streamr::dht::connection::Connection; using streamr::dht::connection::connectionevents::Data; using streamr::dht::helpers::Version; -using streamr::eventemitter::Event; -using streamr::eventemitter::EventEmitter; -using streamr::logger::SLogger; -using streamr::utils::EnableSharedFromThis; -using streamr::utils::Uuid; namespace handshakerevents { struct HandshakeCompleted : Event {}; @@ -180,5 +187,3 @@ class Handshaker : public EventEmitter, }; } // namespace streamr::dht::connection - -#endif // STREAMR_DHT_CONNECTION_HANDSHAKER_HPP diff --git a/packages/streamr-dht/include/streamr-dht/connection/IPendingConnection.hpp b/packages/streamr-dht/modules/connection/IPendingConnection.cppm similarity index 83% rename from packages/streamr-dht/include/streamr-dht/connection/IPendingConnection.hpp rename to packages/streamr-dht/modules/connection/IPendingConnection.cppm index cb52e0c3..a32a604b 100644 --- a/packages/streamr-dht/include/streamr-dht/connection/IPendingConnection.hpp +++ b/packages/streamr-dht/modules/connection/IPendingConnection.cppm @@ -1,12 +1,17 @@ -#ifndef STREAMR_DHT_CONNECTION_IPENDINGCONNECTION_HPP -#define STREAMR_DHT_CONNECTION_IPENDINGCONNECTION_HPP +// Module streamr.dht.IPendingConnection +// CONSOLIDATED from the former header +// streamr-dht/connection/IPendingConnection.hpp (MODERNIZATION.md Phase 2.6): +// this file is now the source of truth. +module; #include #include "packages/dht/protos/DhtRpc.pb.h" -#include "streamr-dht/connection/Connection.hpp" -#include "streamr-eventemitter/EventEmitter.hpp" -namespace streamr::dht::connection { +export module streamr.dht.IPendingConnection; + +import streamr.eventemitter; +import streamr.dht.Connection; +export namespace streamr::dht::connection { using ::dht::PeerDescriptor; @@ -44,5 +49,3 @@ class IPendingConnection : public streamr::eventemitter::ReplayEventEmitter< }; } // namespace streamr::dht::connection - -#endif // STREAMR_DHT_CONNECTION_IPENDINGCONNECTION_HPP diff --git a/packages/streamr-dht/include/streamr-dht/connection/IncomingHandshaker.hpp b/packages/streamr-dht/modules/connection/IncomingHandshaker.cppm similarity index 88% rename from packages/streamr-dht/include/streamr-dht/connection/IncomingHandshaker.hpp rename to packages/streamr-dht/modules/connection/IncomingHandshaker.cppm index 0a73be19..9905f04c 100644 --- a/packages/streamr-dht/include/streamr-dht/connection/IncomingHandshaker.hpp +++ b/packages/streamr-dht/modules/connection/IncomingHandshaker.cppm @@ -1,21 +1,35 @@ -#ifndef STREAMR_DHT_CONNECTION_INCOMING_HANDSHAKER_HPP -#define STREAMR_DHT_CONNECTION_INCOMING_HANDSHAKER_HPP +// Module streamr.dht.IncomingHandshaker +// CONSOLIDATED from the former header +// streamr-dht/connection/IncomingHandshaker.hpp (MODERNIZATION.md Phase 2.6): +// this file is now the source of truth. +module; #include #include #include -#include "streamr-dht/Identifiers.hpp" -#include "streamr-dht/connection/Handshaker.hpp" -#include "streamr-dht/connection/IPendingConnection.hpp" -#include "streamr-dht/connection/PendingConnection.hpp" -#include "streamr-eventemitter/EventEmitter.hpp" +#include -namespace streamr::dht::connection { +export module streamr.dht.IncomingHandshaker; + +import streamr.logger; +import streamr.eventemitter; +import streamr.dht.Connection; +import streamr.dht.Handshaker; +import streamr.dht.IPendingConnection; +import streamr.dht.Identifiers; +import streamr.dht.PendingConnection; + +// Hoisted from the former header (file scope, NOT exported); +// fully qualified: relative namespace names resolve differently +// at file scope than inside the package namespace. +using streamr::eventemitter::HandlerToken; +using streamr::logger::SLogger; + +export namespace streamr::dht::connection { using streamr::dht::connection::IPendingConnection; using streamr::dht::connection::PendingConnection; -using streamr::eventemitter::HandlerToken; class IncomingHandshaker : public Handshaker { private: @@ -171,5 +185,3 @@ class IncomingHandshaker : public Handshaker { }; } // namespace streamr::dht::connection - -#endif diff --git a/packages/streamr-dht/include/streamr-dht/connection/OutgoingHandshaker.hpp b/packages/streamr-dht/modules/connection/OutgoingHandshaker.cppm similarity index 89% rename from packages/streamr-dht/include/streamr-dht/connection/OutgoingHandshaker.hpp rename to packages/streamr-dht/modules/connection/OutgoingHandshaker.cppm index 30335c24..4246bbbf 100644 --- a/packages/streamr-dht/include/streamr-dht/connection/OutgoingHandshaker.hpp +++ b/packages/streamr-dht/modules/connection/OutgoingHandshaker.cppm @@ -1,23 +1,37 @@ -#ifndef STREAMR_DHT_CONNECTION_OUTGOING_HANDSHAKER_HPP -#define STREAMR_DHT_CONNECTION_OUTGOING_HANDSHAKER_HPP +// Module streamr.dht.OutgoingHandshaker +// CONSOLIDATED from the former header +// streamr-dht/connection/OutgoingHandshaker.hpp (MODERNIZATION.md Phase 2.6): +// this file is now the source of truth. +module; #include #include #include -#include "streamr-dht/Identifiers.hpp" -#include "streamr-dht/connection/Connection.hpp" -#include "streamr-dht/connection/Handshaker.hpp" -#include "streamr-dht/connection/PendingConnection.hpp" -#include "streamr-eventemitter/EventEmitter.hpp" +#include -namespace streamr::dht::connection { +export module streamr.dht.OutgoingHandshaker; + +import streamr.dht.IPendingConnection; +import streamr.logger; +import streamr.eventemitter; +import streamr.dht.Connection; +import streamr.dht.Handshaker; +import streamr.dht.Identifiers; +import streamr.dht.PendingConnection; + +// Hoisted from the former header (file scope, NOT exported); +// fully qualified: relative namespace names resolve differently +// at file scope than inside the package namespace. +using streamr::eventemitter::HandlerToken; +using streamr::logger::SLogger; + +export namespace streamr::dht::connection { using streamr::dht::Identifiers; using streamr::dht::connection::Connection; using streamr::dht::connection::IPendingConnection; using streamr::dht::connection::PendingConnection; -using streamr::eventemitter::HandlerToken; class OutgoingHandshaker : public Handshaker { private: @@ -166,5 +180,3 @@ class OutgoingHandshaker : public Handshaker { }; } // namespace streamr::dht::connection - -#endif \ No newline at end of file diff --git a/packages/streamr-dht/include/streamr-dht/connection/PendingConnection.hpp b/packages/streamr-dht/modules/connection/PendingConnection.cppm similarity index 82% rename from packages/streamr-dht/include/streamr-dht/connection/PendingConnection.hpp rename to packages/streamr-dht/modules/connection/PendingConnection.cppm index 3b35b801..f76aa1c5 100644 --- a/packages/streamr-dht/include/streamr-dht/connection/PendingConnection.hpp +++ b/packages/streamr-dht/modules/connection/PendingConnection.cppm @@ -1,6 +1,8 @@ - -#ifndef STREAMR_DHT_CONNECTION_PENDINGCONNECTION_HPP -#define STREAMR_DHT_CONNECTION_PENDINGCONNECTION_HPP +// Module streamr.dht.PendingConnection +// CONSOLIDATED from the former header +// streamr-dht/connection/PendingConnection.hpp (MODERNIZATION.md Phase 2.6): +// this file is now the source of truth. +module; #include #include @@ -9,19 +11,29 @@ #include #include #include "packages/dht/protos/DhtRpc.pb.h" -#include "streamr-dht/Identifiers.hpp" -#include "streamr-dht/connection/Connection.hpp" -#include "streamr-dht/connection/IPendingConnection.hpp" -#include "streamr-utils/AbortController.hpp" -#include "streamr-utils/AbortableTimers.hpp" -namespace streamr::dht::connection { +export module streamr.dht.PendingConnection; + +import streamr.utils; +import streamr.logger; +import streamr.dht.Connection; +import streamr.dht.IPendingConnection; +import streamr.dht.Identifiers; + +// Hoisted from the former header (file scope, NOT exported); +// fully qualified: relative namespace names resolve differently +// at file scope than inside the package namespace. +using streamr::utils::AbortableTimers; +using streamr::utils::AbortController; +// Self-sufficient shorthand (was inherited textually from a +// neighboring header before consolidation). +using streamr::logger::SLogger; + +export namespace streamr::dht::connection { using ::dht::PeerDescriptor; using streamr::dht::Identifiers; using streamr::dht::connection::Connection; -using streamr::utils::AbortableTimers; -using streamr::utils::AbortController; class PendingConnection : public IPendingConnection { private: @@ -116,5 +128,3 @@ class PendingConnection : public IPendingConnection { }; } // namespace streamr::dht::connection - -#endif // STREAMR_DHT_CONNECTION_PENDINGCONNECTION_HPP diff --git a/packages/streamr-dht/include/streamr-dht/connection/endpoint/ConnectedEndpointState.hpp b/packages/streamr-dht/modules/connection/endpoint/ConnectedEndpointState.cppm similarity index 89% rename from packages/streamr-dht/include/streamr-dht/connection/endpoint/ConnectedEndpointState.hpp rename to packages/streamr-dht/modules/connection/endpoint/ConnectedEndpointState.cppm index b4259167..97f69331 100644 --- a/packages/streamr-dht/include/streamr-dht/connection/endpoint/ConnectedEndpointState.hpp +++ b/packages/streamr-dht/modules/connection/endpoint/ConnectedEndpointState.cppm @@ -1,22 +1,32 @@ -#ifndef STREAMR_DHT_CONNECTION_ENDPOINT_CONNECTEDENDPOINTSTATE_HPP -#define STREAMR_DHT_CONNECTION_ENDPOINT_CONNECTEDENDPOINTSTATE_HPP +// Module streamr.dht.ConnectedEndpointState +// CONSOLIDATED from the former header +// streamr-dht/connection/endpoint/ConnectedEndpointState.hpp (MODERNIZATION.md +// Phase 2.6): this file is now the source of truth. +module; #include #include #include #include -#include "streamr-dht/connection/Connection.hpp" -#include "streamr-dht/connection/endpoint/EndpointState.hpp" -#include "streamr-dht/connection/endpoint/EndpointStateInterface.hpp" -#include "streamr-eventemitter/EventEmitter.hpp" -#include "streamr-logger/SLogger.hpp" +#include -namespace streamr::dht::connection::endpoint { +export module streamr.dht.ConnectedEndpointState; -using streamr::dht::connection::Connection; +import streamr.eventemitter; +import streamr.logger; +import streamr.dht.Connection; +import streamr.dht.EndpointState; +import streamr.dht.EndpointStateInterface; + +// Hoisted from the former header (file scope, NOT exported); +// fully qualified: relative namespace names resolve differently +// at file scope than inside the package namespace. using streamr::eventemitter::HandlerToken; using streamr::logger::SLogger; +export namespace streamr::dht::connection::endpoint { + +using streamr::dht::connection::Connection; class ConnectedEndpointState : public EndpointState { private: @@ -143,5 +153,3 @@ class ConnectedEndpointState : public EndpointState { }; } // namespace streamr::dht::connection::endpoint - -#endif // STREAMR_DHT_CONNECTION_ENDPOINT_CONNECTEDENDPOINTSTATE_HPP diff --git a/packages/streamr-dht/include/streamr-dht/connection/endpoint/ConnectingEndpointState.hpp b/packages/streamr-dht/modules/connection/endpoint/ConnectingEndpointState.cppm similarity index 87% rename from packages/streamr-dht/include/streamr-dht/connection/endpoint/ConnectingEndpointState.hpp rename to packages/streamr-dht/modules/connection/endpoint/ConnectingEndpointState.cppm index 339f95de..557df4a0 100644 --- a/packages/streamr-dht/include/streamr-dht/connection/endpoint/ConnectingEndpointState.hpp +++ b/packages/streamr-dht/modules/connection/endpoint/ConnectingEndpointState.cppm @@ -1,18 +1,34 @@ -#ifndef STREAMR_DHT_CONNECTION_ENDPOINT_CONNECTINGENDPOINTSTATE_HPP -#define STREAMR_DHT_CONNECTION_ENDPOINT_CONNECTINGENDPOINTSTATE_HPP +// Module streamr.dht.ConnectingEndpointState +// CONSOLIDATED from the former header +// streamr-dht/connection/endpoint/ConnectingEndpointState.hpp (MODERNIZATION.md +// Phase 2.6): this file is now the source of truth. +module; #include #include #include -#include "streamr-dht/connection/endpoint/EndpointState.hpp" -#include "streamr-dht/connection/endpoint/EndpointStateInterface.hpp" -#include "streamr-eventemitter/EventEmitter.hpp" -namespace streamr::dht::connection::endpoint { +export module streamr.dht.ConnectingEndpointState; + +import streamr.logger; +import streamr.dht.Connection; +import streamr.dht.IPendingConnection; +import streamr.eventemitter; +import streamr.dht.EndpointState; +import streamr.dht.EndpointStateInterface; + +// Hoisted from the former header (file scope, NOT exported); +// fully qualified: relative namespace names resolve differently +// at file scope than inside the package namespace. +using streamr::eventemitter::HandlerToken; +// Self-sufficient shorthand (was inherited textually from a +// neighboring header before consolidation). +using streamr::logger::SLogger; + +export namespace streamr::dht::connection::endpoint { using streamr::dht::connection::Connection; using streamr::dht::connection::IPendingConnection; -using streamr::eventemitter::HandlerToken; class ConnectingEndpointState : public EndpointState { private: @@ -140,4 +156,3 @@ class ConnectingEndpointState : public EndpointState { }; } // namespace streamr::dht::connection::endpoint -#endif // STREAMR_DHT_CONNECTION_ENDPOINT_CONNECTINGENDPOINTSTATE_HPP \ No newline at end of file diff --git a/packages/streamr-dht/include/streamr-dht/connection/endpoint/DisconnectedEndpointState.hpp b/packages/streamr-dht/modules/connection/endpoint/DisconnectedEndpointState.cppm similarity index 76% rename from packages/streamr-dht/include/streamr-dht/connection/endpoint/DisconnectedEndpointState.hpp rename to packages/streamr-dht/modules/connection/endpoint/DisconnectedEndpointState.cppm index 50ecb8d1..5f8e9b70 100644 --- a/packages/streamr-dht/include/streamr-dht/connection/endpoint/DisconnectedEndpointState.hpp +++ b/packages/streamr-dht/modules/connection/endpoint/DisconnectedEndpointState.cppm @@ -1,23 +1,31 @@ -#ifndef STREAMR_DHT_CONNECTION_ENDPOINT_DISCONNECTEDENDPOINTSTATE_HPP -#define STREAMR_DHT_CONNECTION_ENDPOINT_DISCONNECTEDENDPOINTSTATE_HPP +// Module streamr.dht.DisconnectedEndpointState +// CONSOLIDATED from the former header +// streamr-dht/connection/endpoint/DisconnectedEndpointState.hpp +// (MODERNIZATION.md Phase 2.6): this file is now the source of truth. +module; #include #include #include -#include "streamr-dht/connection/Connection.hpp" -#include "streamr-dht/connection/IPendingConnection.hpp" -#include "streamr-dht/connection/endpoint/EndpointState.hpp" -#include "streamr-dht/connection/endpoint/EndpointStateInterface.hpp" -#include "streamr-dht/helpers/Errors.hpp" -#include "streamr-logger/SLogger.hpp" +export module streamr.dht.DisconnectedEndpointState; -namespace streamr::dht::connection::endpoint { +import streamr.logger; +import streamr.dht.Connection; +import streamr.dht.EndpointState; +import streamr.dht.EndpointStateInterface; +import streamr.dht.Errors; +import streamr.dht.IPendingConnection; + +// Hoisted from the former header (file scope, NOT exported); +// fully qualified: relative namespace names resolve differently +// at file scope than inside the package namespace. +using streamr::logger::SLogger; +export namespace streamr::dht::connection::endpoint { using streamr::dht::connection::Connection; using streamr::dht::connection::IPendingConnection; using streamr::dht::helpers::SendFailed; -using streamr::logger::SLogger; class DisconnectedEndpointState : public EndpointState { private: @@ -76,5 +84,3 @@ class DisconnectedEndpointState : public EndpointState { }; } // namespace streamr::dht::connection::endpoint - -#endif // STREAMR_DHT_CONNECTION_ENDPOINT_DISCONNECTEDENDPOINTSTATE_HPP \ No newline at end of file diff --git a/packages/streamr-dht/include/streamr-dht/connection/endpoint/Endpoint.hpp b/packages/streamr-dht/modules/connection/endpoint/Endpoint.cppm similarity index 89% rename from packages/streamr-dht/include/streamr-dht/connection/endpoint/Endpoint.hpp rename to packages/streamr-dht/modules/connection/endpoint/Endpoint.cppm index 8599e3b9..c6d11673 100644 --- a/packages/streamr-dht/include/streamr-dht/connection/endpoint/Endpoint.hpp +++ b/packages/streamr-dht/modules/connection/endpoint/Endpoint.cppm @@ -1,5 +1,8 @@ -#ifndef STREAMR_DHT_ENDPOINTS_HPP -#define STREAMR_DHT_ENDPOINTS_HPP +// Module streamr.dht.Endpoint +// CONSOLIDATED from the former header +// streamr-dht/connection/endpoint/Endpoint.hpp (MODERNIZATION.md Phase 2.6): +// this file is now the source of truth. +module; #include #include @@ -8,23 +11,29 @@ #include #include #include "packages/dht/protos/DhtRpc.pb.h" -#include "streamr-dht/connection/endpoint/ConnectedEndpointState.hpp" -#include "streamr-dht/connection/endpoint/ConnectingEndpointState.hpp" -#include "streamr-dht/connection/endpoint/DisconnectedEndpointState.hpp" -#include "streamr-dht/connection/endpoint/EndpointState.hpp" -#include "streamr-dht/connection/endpoint/EndpointStateInterface.hpp" -#include "streamr-dht/connection/endpoint/InitialEndpointState.hpp" -#include "streamr-eventemitter/EventEmitter.hpp" -#include "streamr-logger/SLogger.hpp" -#include "streamr-utils/EnableSharedFromThis.hpp" - -namespace streamr::dht::connection::endpoint { -using ::dht::PeerDescriptor; +export module streamr.dht.Endpoint; + +import streamr.eventemitter; +import streamr.logger; +import streamr.utils; +import streamr.dht.ConnectedEndpointState; +import streamr.dht.ConnectingEndpointState; +import streamr.dht.DisconnectedEndpointState; +import streamr.dht.EndpointState; +import streamr.dht.EndpointStateInterface; +import streamr.dht.InitialEndpointState; + +// Hoisted from the former header (file scope, NOT exported); +// fully qualified: relative namespace names resolve differently +// at file scope than inside the package namespace. using streamr::eventemitter::Event; using streamr::eventemitter::EventEmitter; using streamr::logger::SLogger; using streamr::utils::EnableSharedFromThis; +export namespace streamr::dht::connection::endpoint { + +using ::dht::PeerDescriptor; namespace endpointevents { @@ -190,5 +199,3 @@ class Endpoint : public EventEmitter, }; } // namespace streamr::dht::connection::endpoint - -#endif diff --git a/packages/streamr-dht/include/streamr-dht/connection/endpoint/EndpointState.hpp b/packages/streamr-dht/modules/connection/endpoint/EndpointState.cppm similarity index 65% rename from packages/streamr-dht/include/streamr-dht/connection/endpoint/EndpointState.hpp rename to packages/streamr-dht/modules/connection/endpoint/EndpointState.cppm index c64443db..95b4a0fb 100644 --- a/packages/streamr-dht/include/streamr-dht/connection/endpoint/EndpointState.hpp +++ b/packages/streamr-dht/modules/connection/endpoint/EndpointState.cppm @@ -1,20 +1,29 @@ -#ifndef STREAMR_DHT_CONNECTION_ENDPOINT_ENDPOINTSTATE_HPP -#define STREAMR_DHT_CONNECTION_ENDPOINT_ENDPOINTSTATE_HPP +// Module streamr.dht.EndpointState +// CONSOLIDATED from the former header +// streamr-dht/connection/endpoint/EndpointState.hpp (MODERNIZATION.md +// Phase 2.6): this file is now the source of truth. +module; #include #include #include -#include "streamr-dht/connection/Connection.hpp" -#include "streamr-dht/connection/IPendingConnection.hpp" -#include "streamr-logger/SLogger.hpp" -#include "streamr-utils/EnableSharedFromThis.hpp" -namespace streamr::dht::connection::endpoint { +export module streamr.dht.EndpointState; -using streamr::dht::connection::Connection; -using streamr::dht::connection::IPendingConnection; +import streamr.logger; +import streamr.utils; +import streamr.dht.Connection; +import streamr.dht.IPendingConnection; + +// Hoisted from the former header (file scope, NOT exported); +// fully qualified: relative namespace names resolve differently +// at file scope than inside the package namespace. using streamr::logger::SLogger; using streamr::utils::EnableSharedFromThis; +export namespace streamr::dht::connection::endpoint { + +using streamr::dht::connection::Connection; +using streamr::dht::connection::IPendingConnection; class EndpointState : public EnableSharedFromThis { protected: @@ -42,5 +51,3 @@ class EndpointState : public EnableSharedFromThis { }; } // namespace streamr::dht::connection::endpoint - -#endif // STREAMR_DHT_CONNECTION_ENDPOINT_ENDPOINTSTATE_HPP diff --git a/packages/streamr-dht/include/streamr-dht/connection/endpoint/EndpointStateInterface.hpp b/packages/streamr-dht/modules/connection/endpoint/EndpointStateInterface.cppm similarity index 75% rename from packages/streamr-dht/include/streamr-dht/connection/endpoint/EndpointStateInterface.hpp rename to packages/streamr-dht/modules/connection/endpoint/EndpointStateInterface.cppm index b6fa773e..eb9253d8 100644 --- a/packages/streamr-dht/include/streamr-dht/connection/endpoint/EndpointStateInterface.hpp +++ b/packages/streamr-dht/modules/connection/endpoint/EndpointStateInterface.cppm @@ -1,13 +1,18 @@ -#ifndef STREAMR_DHT_CONNECTION_ENDPOINT_ENDPOINTSTATEINTERFACE_HPP -#define STREAMR_DHT_CONNECTION_ENDPOINT_ENDPOINTSTATEINTERFACE_HPP +// Module streamr.dht.EndpointStateInterface +// CONSOLIDATED from the former header +// streamr-dht/connection/endpoint/EndpointStateInterface.hpp (MODERNIZATION.md +// Phase 2.6): this file is now the source of truth. +module; #include #include #include -#include "streamr-dht/connection/Connection.hpp" -#include "streamr-dht/connection/IPendingConnection.hpp" -namespace streamr::dht::connection::endpoint { +export module streamr.dht.EndpointStateInterface; + +import streamr.dht.Connection; +import streamr.dht.IPendingConnection; +export namespace streamr::dht::connection::endpoint { using streamr::dht::connection::Connection; using streamr::dht::connection::IPendingConnection; @@ -33,5 +38,3 @@ class EndpointStateInterface { }; } // namespace streamr::dht::connection::endpoint - -#endif // STREAMR_DHT_CONNECTION_ENDPOINT_ENDPOINTSTATEINTERFACE_HPP diff --git a/packages/streamr-dht/include/streamr-dht/connection/endpoint/InitialEndpointState.hpp b/packages/streamr-dht/modules/connection/endpoint/InitialEndpointState.cppm similarity index 77% rename from packages/streamr-dht/include/streamr-dht/connection/endpoint/InitialEndpointState.hpp rename to packages/streamr-dht/modules/connection/endpoint/InitialEndpointState.cppm index cfb9a821..63845525 100644 --- a/packages/streamr-dht/include/streamr-dht/connection/endpoint/InitialEndpointState.hpp +++ b/packages/streamr-dht/modules/connection/endpoint/InitialEndpointState.cppm @@ -1,22 +1,31 @@ -#ifndef STREAMR_DHT_CONNECTION_ENDPOINT_INITIALENDPOINTSTATE_HPP -#define STREAMR_DHT_CONNECTION_ENDPOINT_INITIALENDPOINTSTATE_HPP +// Module streamr.dht.InitialEndpointState +// CONSOLIDATED from the former header +// streamr-dht/connection/endpoint/InitialEndpointState.hpp (MODERNIZATION.md +// Phase 2.6): this file is now the source of truth. +module; #include #include #include -#include "streamr-dht/connection/Connection.hpp" -#include "streamr-dht/connection/IPendingConnection.hpp" -#include "streamr-dht/connection/endpoint/EndpointState.hpp" -#include "streamr-dht/connection/endpoint/EndpointStateInterface.hpp" -#include "streamr-dht/helpers/Errors.hpp" -#include "streamr-logger/SLogger.hpp" -namespace streamr::dht::connection::endpoint { +export module streamr.dht.InitialEndpointState; + +import streamr.logger; +import streamr.dht.Connection; +import streamr.dht.EndpointState; +import streamr.dht.EndpointStateInterface; +import streamr.dht.Errors; +import streamr.dht.IPendingConnection; + +// Hoisted from the former header (file scope, NOT exported); +// fully qualified: relative namespace names resolve differently +// at file scope than inside the package namespace. +using streamr::logger::SLogger; +export namespace streamr::dht::connection::endpoint { using streamr::dht::connection::Connection; using streamr::dht::connection::IPendingConnection; using streamr::dht::helpers::SendFailed; -using streamr::logger::SLogger; class InitialEndpointState : public EndpointState { private: @@ -75,5 +84,3 @@ class InitialEndpointState : public EndpointState { }; } // namespace streamr::dht::connection::endpoint - -#endif // STREAMR_DHT_CONNECTION_ENDPOINT_INITIALENDPOINTSTATE_HPP \ No newline at end of file diff --git a/packages/streamr-dht/include/streamr-dht/connection/websocket/WebsocketClientConnection.hpp b/packages/streamr-dht/modules/connection/websocket/WebsocketClientConnection.cppm similarity index 71% rename from packages/streamr-dht/include/streamr-dht/connection/websocket/WebsocketClientConnection.hpp rename to packages/streamr-dht/modules/connection/websocket/WebsocketClientConnection.cppm index cc55dd25..119e49f0 100644 --- a/packages/streamr-dht/include/streamr-dht/connection/websocket/WebsocketClientConnection.hpp +++ b/packages/streamr-dht/modules/connection/websocket/WebsocketClientConnection.cppm @@ -1,16 +1,28 @@ -#ifndef STREAMR_DHT_CONNECTION_WEBSOCKET_CLIENTWEBSOCKET_HPP -#define STREAMR_DHT_CONNECTION_WEBSOCKET_CLIENTWEBSOCKET_HPP +// Module streamr.dht.WebsocketClientConnection +// CONSOLIDATED from the former header +// streamr-dht/connection/websocket/WebsocketClientConnection.hpp +// (MODERNIZATION.md Phase 2.6): this file is now the source of truth. +module; #include #include -#include "streamr-dht/connection/websocket/WebsocketConnection.hpp" -#include "streamr-logger/SLogger.hpp" -#include "streamr-utils/waitForEvent.hpp" -namespace streamr::dht::connection::websocket { +#include +export module streamr.dht.WebsocketClientConnection; + +import streamr.dht.Connection; +import streamr.logger; +import streamr.utils; +import streamr.dht.WebsocketConnection; + +// Hoisted from the former header (file scope, NOT exported); +// fully qualified: relative namespace names resolve differently +// at file scope than inside the package namespace. using streamr::logger::SLogger; using streamr::utils::waitForEvent; +export namespace streamr::dht::connection::websocket { + class WebsocketClientConnection : public WebsocketConnection { private: // Only allow creation of this class via newInstance() @@ -52,5 +64,3 @@ class WebsocketClientConnection : public WebsocketConnection { }; } // namespace streamr::dht::connection::websocket - -#endif \ No newline at end of file diff --git a/packages/streamr-dht/include/streamr-dht/connection/websocket/WebsocketClientConnector.hpp b/packages/streamr-dht/modules/connection/websocket/WebsocketClientConnector.cppm similarity index 86% rename from packages/streamr-dht/include/streamr-dht/connection/websocket/WebsocketClientConnector.hpp rename to packages/streamr-dht/modules/connection/websocket/WebsocketClientConnector.cppm index 0c711063..b3948e08 100644 --- a/packages/streamr-dht/include/streamr-dht/connection/websocket/WebsocketClientConnector.hpp +++ b/packages/streamr-dht/modules/connection/websocket/WebsocketClientConnector.cppm @@ -1,18 +1,34 @@ -#ifndef STREAMR_DHT_CONNECTION_WEBSOCKET_WEBSOCKETCLIENTCONNECTOR_HPP -#define STREAMR_DHT_CONNECTION_WEBSOCKET_WEBSOCKETCLIENTCONNECTOR_HPP +// Module streamr.dht.WebsocketClientConnector +// CONSOLIDATED from the former header +// streamr-dht/connection/websocket/WebsocketClientConnector.hpp +// (MODERNIZATION.md Phase 2.6): this file is now the source of truth. +module; #include #include "packages/dht/protos/DhtRpc.pb.h" -#include "streamr-dht/Identifiers.hpp" -#include "streamr-dht/connection/IPendingConnection.hpp" -#include "streamr-dht/connection/OutgoingHandshaker.hpp" -#include "streamr-dht/connection/PendingConnection.hpp" -#include "streamr-dht/connection/websocket/WebsocketClientConnection.hpp" -#include "streamr-dht/connection/websocket/WebsocketClientConnectorRpcLocal.hpp" -#include "streamr-dht/helpers/Connectivity.hpp" -#include "streamr-dht/transport/ListeningRpcCommunicator.hpp" -namespace streamr::dht::connection::websocket { +#include + +#include + +export module streamr.dht.WebsocketClientConnector; + +import streamr.dht.Handshaker; +import streamr.dht.Connection; +import streamr.logger; +import streamr.utils; +import streamr.dht.Connectivity; +import streamr.dht.IPendingConnection; +import streamr.dht.Identifiers; +import streamr.dht.ListeningRpcCommunicator; +import streamr.dht.OutgoingHandshaker; +import streamr.dht.PendingConnection; +import streamr.dht.WebsocketClientConnection; +import streamr.dht.WebsocketClientConnectorRpcLocal; +using streamr::logger::SLogger; +using streamr::utils::AbortController; + +export namespace streamr::dht::connection::websocket { using ::dht::ConnectivityMethod; using ::dht::PeerDescriptor; @@ -149,5 +165,3 @@ class WebsocketClientConnector { }; } // namespace streamr::dht::connection::websocket - -#endif // STREAMR_DHT_CONNECTION_WEBSOCKET_WEBSOCKETCLIENTCONNECTOR_HPP diff --git a/packages/streamr-dht/include/streamr-dht/connection/websocket/WebsocketClientConnectorRpcLocal.hpp b/packages/streamr-dht/modules/connection/websocket/WebsocketClientConnectorRpcLocal.cppm similarity index 70% rename from packages/streamr-dht/include/streamr-dht/connection/websocket/WebsocketClientConnectorRpcLocal.hpp rename to packages/streamr-dht/modules/connection/websocket/WebsocketClientConnectorRpcLocal.cppm index 1bf3998e..999ce5d4 100644 --- a/packages/streamr-dht/include/streamr-dht/connection/websocket/WebsocketClientConnectorRpcLocal.hpp +++ b/packages/streamr-dht/modules/connection/websocket/WebsocketClientConnectorRpcLocal.cppm @@ -1,23 +1,34 @@ -#ifndef STREAMR_DHT_CONNECTION_WEBSOCKET_WEBSOCKETCLIENTCONNECTORRPCLOCAL_HPP -#define STREAMR_DHT_CONNECTION_WEBSOCKET_WEBSOCKETCLIENTCONNECTORRPCLOCAL_HPP +// Module streamr.dht.WebsocketClientConnectorRpcLocal +// CONSOLIDATED from the former header +// streamr-dht/connection/websocket/WebsocketClientConnectorRpcLocal.hpp +// (MODERNIZATION.md Phase 2.6): this file is now the source of truth. +module; #include #include "packages/dht/protos/DhtRpc.pb.h" #include "packages/dht/protos/DhtRpc.server.pb.h" -#include "streamr-dht/Identifiers.hpp" -#include "streamr-dht/connection/IPendingConnection.hpp" -#include "streamr-dht/connection/PendingConnection.hpp" -#include "streamr-dht/rpc-protocol/DhtCallContext.hpp" -#include "streamr-utils/AbortController.hpp" -namespace streamr::dht::connection::websocket { +#include + +export module streamr.dht.WebsocketClientConnectorRpcLocal; + +import streamr.utils; +import streamr.dht.DhtCallContext; +import streamr.dht.IPendingConnection; +import streamr.dht.Identifiers; +import streamr.dht.PendingConnection; + +// Hoisted from the former header (file scope, NOT exported); +// fully qualified: relative namespace names resolve differently +// at file scope than inside the package namespace. +using streamr::utils::AbortSignal; +export namespace streamr::dht::connection::websocket { using ::dht::PeerDescriptor; using ::dht::WebsocketClientConnectorRpc; using ::dht::WebsocketConnectionRequest; using streamr::dht::DhtAddress; using streamr::dht::rpcprotocol::DhtCallContext; -using streamr::utils::AbortSignal; struct WebsocketClientConnectorRpcLocalOptions { std::function(const PeerDescriptor&)> @@ -58,5 +69,3 @@ class WebsocketClientConnectorRpcLocal }; } // namespace streamr::dht::connection::websocket - -#endif // STREAMR_DHT_CONNECTION_WEBSOCKET_WEBSOCKETCLIENTCONNECTORRPCLOCAL_HPP \ No newline at end of file diff --git a/packages/streamr-dht/include/streamr-dht/connection/websocket/WebsocketClientConnectorRpcRemote.hpp b/packages/streamr-dht/modules/connection/websocket/WebsocketClientConnectorRpcRemote.cppm similarity index 70% rename from packages/streamr-dht/include/streamr-dht/connection/websocket/WebsocketClientConnectorRpcRemote.hpp rename to packages/streamr-dht/modules/connection/websocket/WebsocketClientConnectorRpcRemote.cppm index eae0c180..51ff3e40 100644 --- a/packages/streamr-dht/include/streamr-dht/connection/websocket/WebsocketClientConnectorRpcRemote.hpp +++ b/packages/streamr-dht/modules/connection/websocket/WebsocketClientConnectorRpcRemote.cppm @@ -1,21 +1,30 @@ -#ifndef STREAMR_DHT_CONNECTION_WEBSOCKET_WEBSOCKETCLIENTCONNECTORRPCREMOTE_HPP -#define STREAMR_DHT_CONNECTION_WEBSOCKET_WEBSOCKETCLIENTCONNECTORRPCREMOTE_HPP +// Module streamr.dht.WebsocketClientConnectorRpcRemote +// CONSOLIDATED from the former header +// streamr-dht/connection/websocket/WebsocketClientConnectorRpcRemote.hpp +// (MODERNIZATION.md Phase 2.6): this file is now the source of truth. +module; #include #include "packages/dht/protos/DhtRpc.client.pb.h" -#include "streamr-dht/Identifiers.hpp" -#include "streamr-dht/dht/contact/RpcRemote.hpp" -#include "streamr-dht/rpc-protocol/DhtCallContext.hpp" -#include "streamr-logger/SLogger.hpp" -namespace streamr::dht::connection::websocket { +export module streamr.dht.WebsocketClientConnectorRpcRemote; + +import streamr.logger; +import streamr.dht.DhtCallContext; +import streamr.dht.Identifiers; +import streamr.dht.RpcRemote; + +// Hoisted from the former header (file scope, NOT exported); +// fully qualified: relative namespace names resolve differently +// at file scope than inside the package namespace. +using streamr::logger::SLogger; +export namespace streamr::dht::connection::websocket { using ::dht::PeerDescriptor; using ::dht::WebsocketConnectionRequest; using streamr::dht::Identifiers; using streamr::dht::contact::DhtCallContext; using streamr::dht::contact::RpcRemote; -using streamr::logger::SLogger; using RpcCommunicator = streamr::protorpc::RpcCommunicator; using WebsocketClientConnectorRpcClient = @@ -47,5 +56,3 @@ class WebsocketClientConnectorRpcRemote }; } // namespace streamr::dht::connection::websocket - -#endif diff --git a/packages/streamr-dht/include/streamr-dht/connection/websocket/WebsocketConnection.hpp b/packages/streamr-dht/modules/connection/websocket/WebsocketConnection.cppm similarity index 94% rename from packages/streamr-dht/include/streamr-dht/connection/websocket/WebsocketConnection.hpp rename to packages/streamr-dht/modules/connection/websocket/WebsocketConnection.cppm index 9000d8ef..2902d9e1 100644 --- a/packages/streamr-dht/include/streamr-dht/connection/websocket/WebsocketConnection.hpp +++ b/packages/streamr-dht/modules/connection/websocket/WebsocketConnection.cppm @@ -1,20 +1,31 @@ -#ifndef STREAMR_DHT_CONNECTION_WEBSOCKET_CONNECTION_HPP -#define STREAMR_DHT_CONNECTION_WEBSOCKET_CONNECTION_HPP +// Module streamr.dht.WebsocketConnection +// CONSOLIDATED from the former header +// streamr-dht/connection/websocket/WebsocketConnection.hpp (MODERNIZATION.md +// Phase 2.6): this file is now the source of truth. +module; #include #include -#include "streamr-dht/connection/Connection.hpp" -#include "streamr-logger/SLogger.hpp" -#include "streamr-utils/EnableSharedFromThis.hpp" -namespace streamr::dht::connection::websocket { +#include + +export module streamr.dht.WebsocketConnection; + +import streamr.logger; +import streamr.utils; +import streamr.dht.Connection; + +// Hoisted from the former header (file scope, NOT exported); +// fully qualified: relative namespace names resolve differently +// at file scope than inside the package namespace. +using streamr::logger::SLogger; +using streamr::utils::EnableSharedFromThis; +export namespace streamr::dht::connection::websocket { using streamr::dht::connection::connectionevents::Connected; using streamr::dht::connection::connectionevents::Data; using streamr::dht::connection::connectionevents::Disconnected; using streamr::dht::connection::connectionevents::Error; -using streamr::logger::SLogger; -using streamr::utils::EnableSharedFromThis; inline constexpr size_t maxMessageSize = 1048576; @@ -279,5 +290,3 @@ class WebsocketConnection : public Connection, public EnableSharedFromThis { }; } // namespace streamr::dht::connection::websocket - -#endif \ No newline at end of file diff --git a/packages/streamr-dht/include/streamr-dht/connection/websocket/WebsocketServer.hpp b/packages/streamr-dht/modules/connection/websocket/WebsocketServer.cppm similarity index 90% rename from packages/streamr-dht/include/streamr-dht/connection/websocket/WebsocketServer.hpp rename to packages/streamr-dht/modules/connection/websocket/WebsocketServer.cppm index c1d812c4..495314a3 100644 --- a/packages/streamr-dht/include/streamr-dht/connection/websocket/WebsocketServer.hpp +++ b/packages/streamr-dht/modules/connection/websocket/WebsocketServer.cppm @@ -1,5 +1,8 @@ -#ifndef STREAMR_DHT_CONNECTION_WEBSOCKET_WEBSERVER_HPP -#define STREAMR_DHT_CONNECTION_WEBSOCKET_WEBSERVER_HPP +// Module streamr.dht.WebsocketServer +// CONSOLIDATED from the former header +// streamr-dht/connection/websocket/WebsocketServer.hpp (MODERNIZATION.md +// Phase 2.6): this file is now the source of truth. +module; #include #include @@ -8,15 +11,31 @@ #include #include #include -#include "streamr-dht/connection/websocket/WebsocketServerConnection.hpp" -#include "streamr-dht/helpers/CertificateHelper.hpp" -#include "streamr-dht/helpers/Errors.hpp" -#include "streamr-dht/types/PortRange.hpp" -#include "streamr-dht/types/TlsCertificateFiles.hpp" -#include "streamr-logger/SLogger.hpp" -#include "streamr-utils/Uuid.hpp" -namespace streamr::dht::connection::websocket { +export module streamr.dht.WebsocketServer; + +import streamr.eventemitter; +import streamr.dht.Connection; +import streamr.dht.WebsocketConnection; +import streamr.logger; +import streamr.utils; +import streamr.dht.CertificateHelper; +import streamr.dht.Errors; +import streamr.dht.PortRange; +import streamr.dht.TlsCertificateFiles; +import streamr.dht.WebsocketServerConnection; + +// Hoisted from the former header (file scope, NOT exported); +// fully qualified: relative namespace names resolve differently +// at file scope than inside the package namespace. +using streamr::logger::SLogger; +using streamr::utils::Uuid; +// Self-sufficient shorthand (was inherited textually from a +// neighboring header before consolidation). +using streamr::eventemitter::Event; +using streamr::eventemitter::EventEmitter; + +export namespace streamr::dht::connection::websocket { using streamr::dht::connection::Url; using streamr::dht::connection::connectionevents::Data; @@ -27,8 +46,6 @@ using streamr::dht::helpers::TlsCertificate; using streamr::dht::helpers::WebsocketServerStartError; using streamr::dht::types::PortRange; using streamr::dht::types::TlsCertificateFiles; -using streamr::logger::SLogger; -using streamr::utils::Uuid; struct WebsocketServerConfig { PortRange portRange; @@ -250,5 +267,3 @@ class WebsocketServer : public EventEmitter { }; } // namespace streamr::dht::connection::websocket - -#endif // STREAMR_DHT_CONNECTION_WEBSOCKET_WEBSERVER_HPP \ No newline at end of file diff --git a/packages/streamr-dht/include/streamr-dht/connection/websocket/WebsocketServerConnection.hpp b/packages/streamr-dht/modules/connection/websocket/WebsocketServerConnection.cppm similarity index 73% rename from packages/streamr-dht/include/streamr-dht/connection/websocket/WebsocketServerConnection.hpp rename to packages/streamr-dht/modules/connection/websocket/WebsocketServerConnection.cppm index 728e8111..d246396a 100644 --- a/packages/streamr-dht/include/streamr-dht/connection/websocket/WebsocketServerConnection.hpp +++ b/packages/streamr-dht/modules/connection/websocket/WebsocketServerConnection.cppm @@ -1,17 +1,27 @@ -#ifndef STREAMR_DHT_CONNECTION_WEBSOCKET_SERVERCONNECTION_HPP -#define STREAMR_DHT_CONNECTION_WEBSOCKET_SERVERCONNECTION_HPP +// Module streamr.dht.WebsocketServerConnection +// CONSOLIDATED from the former header +// streamr-dht/connection/websocket/WebsocketServerConnection.hpp +// (MODERNIZATION.md Phase 2.6): this file is now the source of truth. +module; #include #include -#include "streamr-dht/connection/websocket/WebsocketConnection.hpp" -#include "streamr-eventemitter/EventEmitter.hpp" -#include "streamr-logger/SLogger.hpp" -namespace streamr::dht::connection::websocket { +export module streamr.dht.WebsocketServerConnection; -using streamr::dht::connection::Url; +import streamr.dht.Connection; +import streamr.eventemitter; +import streamr.logger; +import streamr.dht.WebsocketConnection; + +// Hoisted from the former header (file scope, NOT exported); +// fully qualified: relative namespace names resolve differently +// at file scope than inside the package namespace. using streamr::eventemitter::HandlerToken; using streamr::logger::SLogger; +export namespace streamr::dht::connection::websocket { + +using streamr::dht::connection::Url; class WebsocketServerConnection : public WebsocketConnection { private: Url mResourceURL; @@ -57,5 +67,3 @@ class WebsocketServerConnection : public WebsocketConnection { }; } // namespace streamr::dht::connection::websocket - -#endif // STREAMR_DHT_CONNECTION_WEBSOCKET_SERVERCONNECTION_HPP \ No newline at end of file diff --git a/packages/streamr-dht/include/streamr-dht/connection/websocket/WebsocketServerConnector.hpp b/packages/streamr-dht/modules/connection/websocket/WebsocketServerConnector.cppm similarity index 90% rename from packages/streamr-dht/include/streamr-dht/connection/websocket/WebsocketServerConnector.hpp rename to packages/streamr-dht/modules/connection/websocket/WebsocketServerConnector.cppm index 14b7ee66..9023934b 100644 --- a/packages/streamr-dht/include/streamr-dht/connection/websocket/WebsocketServerConnector.hpp +++ b/packages/streamr-dht/modules/connection/websocket/WebsocketServerConnector.cppm @@ -1,27 +1,45 @@ -#ifndef STREAMR_DHT_CONNECTION_WEBSOCKET_WEBSOCKETSERVERCONNECTOR_HPP -#define STREAMR_DHT_CONNECTION_WEBSOCKET_WEBSOCKETSERVERCONNECTOR_HPP +// Module streamr.dht.WebsocketServerConnector +// CONSOLIDATED from the former header +// streamr-dht/connection/websocket/WebsocketServerConnector.hpp +// (MODERNIZATION.md Phase 2.6): this file is now the source of truth. +module; #include #include #include #include #include "packages/dht/protos/DhtRpc.pb.h" -#include "streamr-dht/Identifiers.hpp" -#include "streamr-dht/connection/Handshaker.hpp" -#include "streamr-dht/connection/IPendingConnection.hpp" -#include "streamr-dht/connection/IncomingHandshaker.hpp" -#include "streamr-dht/connection/PendingConnection.hpp" -#include "streamr-dht/connection/websocket/WebsocketServer.hpp" -#include "streamr-dht/helpers/Version.hpp" -#include "streamr-dht/transport/ListeningRpcCommunicator.hpp" -#include "streamr-dht/transport/Transport.hpp" -#include "streamr-dht/types/NatType.hpp" -#include "streamr-dht/types/PortRange.hpp" -#include "streamr-dht/types/TlsCertificateFiles.hpp" -#include "streamr-utils/AbortController.hpp" -#include "streamr-utils/Ipv4Helper.hpp" - -namespace streamr::dht::connection::websocket { + +#include + +export module streamr.dht.WebsocketServerConnector; + +import streamr.dht.WebsocketServerConnection; +import streamr.logger; +import streamr.utils; +import streamr.dht.Handshaker; +import streamr.dht.IPendingConnection; +import streamr.dht.Identifiers; +import streamr.dht.IncomingHandshaker; +import streamr.dht.ListeningRpcCommunicator; +import streamr.dht.NatType; +import streamr.dht.PendingConnection; +import streamr.dht.PortRange; +import streamr.dht.TlsCertificateFiles; +import streamr.dht.Transport; +import streamr.dht.Version; +import streamr.dht.WebsocketServer; + +// Hoisted from the former header (file scope, NOT exported); +// fully qualified: relative namespace names resolve differently +// at file scope than inside the package namespace. +using streamr::logger::SLogger; +using streamr::utils::AbortController; +using streamr::utils::Ipv4Helper; + +using streamr::utils::Uuid; + +export namespace streamr::dht::connection::websocket { using ::dht::ConnectivityResponse; using streamr::dht::connection::IncomingHandshaker; @@ -34,8 +52,6 @@ using streamr::dht::transport::ListeningRpcCommunicator; using streamr::dht::transport::Transport; using streamr::dht::types::PortRange; using streamr::dht::types::TlsCertificateFiles; -using streamr::utils::AbortController; -using streamr::utils::Ipv4Helper; // NOLINTNEXTLINE(readability-identifier-naming) namespace NatType = streamr::dht::types::NatType; @@ -258,4 +274,3 @@ class WebsocketServerConnector { }; } // namespace streamr::dht::connection::websocket -#endif diff --git a/packages/streamr-dht/include/streamr-dht/dht/contact/RpcRemote.hpp b/packages/streamr-dht/modules/dht/contact/RpcRemote.cppm similarity index 89% rename from packages/streamr-dht/include/streamr-dht/dht/contact/RpcRemote.hpp rename to packages/streamr-dht/modules/dht/contact/RpcRemote.cppm index 4a5f5f0e..7785e595 100644 --- a/packages/streamr-dht/include/streamr-dht/dht/contact/RpcRemote.hpp +++ b/packages/streamr-dht/modules/dht/contact/RpcRemote.cppm @@ -1,14 +1,18 @@ -#ifndef STREAMR_DHT_DHT_CONTACT_RPCREMOTE_HPP -#define STREAMR_DHT_DHT_CONTACT_RPCREMOTE_HPP +// Module streamr.dht.RpcRemote +// CONSOLIDATED from the former header streamr-dht/dht/contact/RpcRemote.hpp +// (MODERNIZATION.md Phase 2.6): this file is now the source of truth. +module; #include #include #include "packages/dht/protos/DhtRpc.pb.h" -#include "streamr-dht/connection/Connection.hpp" -#include "streamr-dht/helpers/Connectivity.hpp" -#include "streamr-dht/rpc-protocol/DhtCallContext.hpp" -namespace streamr::dht::contact { +export module streamr.dht.RpcRemote; + +import streamr.dht.Connection; +import streamr.dht.Connectivity; +import streamr.dht.DhtCallContext; +export namespace streamr::dht::contact { using ::dht::PeerDescriptor; using streamr::dht::connection::ConnectionType; @@ -98,5 +102,3 @@ class RpcRemote { }; } // namespace streamr::dht::contact - -#endif \ No newline at end of file diff --git a/packages/streamr-dht/include/streamr-dht/dht/routing/DuplicateDetector.hpp b/packages/streamr-dht/modules/dht/routing/DuplicateDetector.cppm similarity index 82% rename from packages/streamr-dht/include/streamr-dht/dht/routing/DuplicateDetector.hpp rename to packages/streamr-dht/modules/dht/routing/DuplicateDetector.cppm index cafb5914..a9c331ab 100644 --- a/packages/streamr-dht/include/streamr-dht/dht/routing/DuplicateDetector.hpp +++ b/packages/streamr-dht/modules/dht/routing/DuplicateDetector.cppm @@ -1,12 +1,16 @@ -#ifndef STREAMR_DHT_DUPLICATE_DETECTOR_HPP -#define STREAMR_DHT_DUPLICATE_DETECTOR_HPP +// Module streamr.dht.DuplicateDetector +// CONSOLIDATED from the former header +// streamr-dht/dht/routing/DuplicateDetector.hpp (MODERNIZATION.md Phase 2.6): +// this file is now the source of truth. +module; #include #include #include #include -namespace streamr::dht::routing { +export module streamr.dht.DuplicateDetector; +export namespace streamr::dht::routing { class DuplicateDetector { private: @@ -50,5 +54,3 @@ class DuplicateDetector { }; } // namespace streamr::dht::routing - -#endif diff --git a/packages/streamr-dht/include/streamr-dht/helpers/AddressTools.hpp b/packages/streamr-dht/modules/helpers/AddressTools.cppm similarity index 80% rename from packages/streamr-dht/include/streamr-dht/helpers/AddressTools.hpp rename to packages/streamr-dht/modules/helpers/AddressTools.cppm index b889264e..f86f9b54 100644 --- a/packages/streamr-dht/include/streamr-dht/helpers/AddressTools.hpp +++ b/packages/streamr-dht/modules/helpers/AddressTools.cppm @@ -1,5 +1,7 @@ -#ifndef ADDRESS_TOOLS_HPP -#define ADDRESS_TOOLS_HPP +// Module streamr.dht.AddressTools +// CONSOLIDATED from the former header streamr-dht/helpers/AddressTools.hpp +// (MODERNIZATION.md Phase 2.6): this file is now the source of truth. +module; #include #include @@ -8,7 +10,8 @@ #include #include -namespace streamr::dht::helpers { +export module streamr.dht.AddressTools; +export namespace streamr::dht::helpers { class AddressTools { public: @@ -38,5 +41,3 @@ class AddressTools { }; } // namespace streamr::dht::helpers - -#endif // ADDRESS_TOOLS_HPP \ No newline at end of file diff --git a/packages/streamr-dht/include/streamr-dht/helpers/CertificateHelper.hpp b/packages/streamr-dht/modules/helpers/CertificateHelper.cppm similarity index 94% rename from packages/streamr-dht/include/streamr-dht/helpers/CertificateHelper.hpp rename to packages/streamr-dht/modules/helpers/CertificateHelper.cppm index 7513f793..afeec064 100644 --- a/packages/streamr-dht/include/streamr-dht/helpers/CertificateHelper.hpp +++ b/packages/streamr-dht/modules/helpers/CertificateHelper.cppm @@ -1,5 +1,7 @@ -#ifndef CERTIFICATE_HELPER_HPP -#define CERTIFICATE_HELPER_HPP +// Module streamr.dht.CertificateHelper +// CONSOLIDATED from the former header streamr-dht/helpers/CertificateHelper.hpp +// (MODERNIZATION.md Phase 2.6): this file is now the source of truth. +module; #include #include @@ -15,7 +17,8 @@ #include #include -namespace streamr::dht::helpers { +export module streamr.dht.CertificateHelper; +export namespace streamr::dht::helpers { struct TlsCertificate { std::string privateKey; @@ -136,5 +139,3 @@ class CertificateHelper { }; } // namespace streamr::dht::helpers - -#endif \ No newline at end of file diff --git a/packages/streamr-dht/include/streamr-dht/helpers/Connectivity.hpp b/packages/streamr-dht/modules/helpers/Connectivity.cppm similarity index 83% rename from packages/streamr-dht/include/streamr-dht/helpers/Connectivity.hpp rename to packages/streamr-dht/modules/helpers/Connectivity.cppm index 701ed0c0..c42a55b6 100644 --- a/packages/streamr-dht/include/streamr-dht/helpers/Connectivity.hpp +++ b/packages/streamr-dht/modules/helpers/Connectivity.cppm @@ -1,13 +1,17 @@ -#ifndef STREAMR_DHT_HELPERS_CONNECTIVITY_HPP -#define STREAMR_DHT_HELPERS_CONNECTIVITY_HPP +// Module streamr.dht.Connectivity +// CONSOLIDATED from the former header streamr-dht/helpers/Connectivity.hpp +// (MODERNIZATION.md Phase 2.6): this file is now the source of truth. +module; #include #include #include "packages/dht/protos/DhtRpc.pb.h" -#include "streamr-dht/connection/Connection.hpp" -#include "streamr-dht/helpers/AddressTools.hpp" -namespace streamr::dht::helpers { +export module streamr.dht.Connectivity; + +import streamr.dht.AddressTools; +import streamr.dht.Connection; +export namespace streamr::dht::helpers { using ::dht::ConnectivityMethod; using ::dht::NodeType; @@ -51,5 +55,3 @@ class Connectivity { }; } // namespace streamr::dht::helpers - -#endif // STREAMR_DHT_HELPERS_CONNECTIVITY_HPP \ No newline at end of file diff --git a/packages/streamr-dht/include/streamr-dht/helpers/Errors.hpp b/packages/streamr-dht/modules/helpers/Errors.cppm similarity index 91% rename from packages/streamr-dht/include/streamr-dht/helpers/Errors.hpp rename to packages/streamr-dht/modules/helpers/Errors.cppm index cb81a640..b796793c 100644 --- a/packages/streamr-dht/include/streamr-dht/helpers/Errors.hpp +++ b/packages/streamr-dht/modules/helpers/Errors.cppm @@ -1,5 +1,7 @@ -#ifndef STREAMR_DHT_HELPERS_ERRORS_HPP -#define STREAMR_DHT_HELPERS_ERRORS_HPP +// Module streamr.dht.Errors +// CONSOLIDATED from the former header streamr-dht/helpers/Errors.hpp +// (MODERNIZATION.md Phase 2.6): this file is now the source of truth. +module; #include #include @@ -7,7 +9,8 @@ #include #include -namespace streamr::dht::helpers { +export module streamr.dht.Errors; +export namespace streamr::dht::helpers { // NOLINTBEGIN enum class ErrorCode { @@ -93,5 +96,3 @@ using DhtException = std::variant< SendFailed>; } // namespace streamr::dht::helpers - -#endif // STREAMR_DHT_HELPERS_ERRORS_HPP diff --git a/packages/streamr-dht/include/streamr-dht/helpers/Offerer.hpp b/packages/streamr-dht/modules/helpers/Offerer.cppm similarity index 76% rename from packages/streamr-dht/include/streamr-dht/helpers/Offerer.hpp rename to packages/streamr-dht/modules/helpers/Offerer.cppm index b368580c..2014d85c 100644 --- a/packages/streamr-dht/include/streamr-dht/helpers/Offerer.hpp +++ b/packages/streamr-dht/modules/helpers/Offerer.cppm @@ -1,13 +1,17 @@ -#ifndef STREAMR_DHT_OFFERER_HPP -#define STREAMR_DHT_OFFERER_HPP +// Module streamr.dht.Offerer +// CONSOLIDATED from the former header streamr-dht/helpers/Offerer.hpp +// (MODERNIZATION.md Phase 2.6): this file is now the source of truth. +module; #include #include #include #include -#include "streamr-dht/Identifiers.hpp" -namespace streamr::dht::helpers { +export module streamr.dht.Offerer; + +import streamr.dht.Identifiers; +export namespace streamr::dht::helpers { using streamr::dht::DhtAddress; @@ -35,5 +39,3 @@ class OffererHelper { }; } // namespace streamr::dht::helpers - -#endif // STREAMR_DHT_OFFERER_HPP \ No newline at end of file diff --git a/packages/streamr-dht/include/streamr-dht/helpers/Version.hpp b/packages/streamr-dht/modules/helpers/Version.cppm similarity index 84% rename from packages/streamr-dht/include/streamr-dht/helpers/Version.hpp rename to packages/streamr-dht/modules/helpers/Version.cppm index cd6b3686..7bf0157c 100644 --- a/packages/streamr-dht/include/streamr-dht/helpers/Version.hpp +++ b/packages/streamr-dht/modules/helpers/Version.cppm @@ -1,12 +1,15 @@ -#ifndef STREAMR_DHT_VERSION_HPP -#define STREAMR_DHT_VERSION_HPP +// Module streamr.dht.Version +// CONSOLIDATED from the former header streamr-dht/helpers/Version.hpp +// (MODERNIZATION.md Phase 2.6): this file is now the source of truth. +module; #include #include #include #include -namespace streamr::dht::helpers { +export module streamr.dht.Version; +export namespace streamr::dht::helpers { struct VersionNumber { size_t major; @@ -46,5 +49,3 @@ class Version { }; } // namespace streamr::dht::helpers - -#endif // STREAMR_DHT_VERSION_HPP \ No newline at end of file diff --git a/packages/streamr-dht/include/streamr-dht/rpc-protocol/DhtCallContext.hpp b/packages/streamr-dht/modules/rpc-protocol/DhtCallContext.cppm similarity index 62% rename from packages/streamr-dht/include/streamr-dht/rpc-protocol/DhtCallContext.hpp rename to packages/streamr-dht/modules/rpc-protocol/DhtCallContext.cppm index 61d895a3..590bca2c 100644 --- a/packages/streamr-dht/include/streamr-dht/rpc-protocol/DhtCallContext.hpp +++ b/packages/streamr-dht/modules/rpc-protocol/DhtCallContext.cppm @@ -1,10 +1,14 @@ -#ifndef STREAMR_DHT_DHT_CALL_CONTEXT_HPP -#define STREAMR_DHT_DHT_CALL_CONTEXT_HPP +// Module streamr.dht.DhtCallContext +// CONSOLIDATED from the former header +// streamr-dht/rpc-protocol/DhtCallContext.hpp (MODERNIZATION.md Phase 2.6): +// this file is now the source of truth. +module; #include #include "packages/dht/protos/DhtRpc.pb.h" -namespace streamr::dht::rpcprotocol { +export module streamr.dht.DhtCallContext; +export namespace streamr::dht::rpcprotocol { using ::dht::PeerDescriptor; @@ -19,5 +23,3 @@ struct DhtCallContext { std::optional incomingSourceDescriptor; }; } // namespace streamr::dht::rpcprotocol - -#endif \ No newline at end of file diff --git a/packages/streamr-dht/modules/streamr.dht-all.cppm b/packages/streamr-dht/modules/streamr.dht-all.cppm deleted file mode 100644 index 6552e636..00000000 --- a/packages/streamr-dht/modules/streamr.dht-all.cppm +++ /dev/null @@ -1,416 +0,0 @@ -// Coarse façade partition over ALL public headers of streamr-dht. -// One partition (instead of one per header) keeps the number of -// module units — and thus repeated GMF parses of the folly/protobuf -// header stack — minimal during the façade stage. The 2.4 bench -// checkpoint showed per-header partitions multiplying build times. -// Per-header granularity returns at consolidation if needed. -module; - -#include "streamr-dht/Identifiers.hpp" -#include "streamr-dht/connection/Connection.hpp" -#include "streamr-dht/connection/ConnectionLockRpcLocal.hpp" -#include "streamr-dht/connection/ConnectionLockRpcRemote.hpp" -#include "streamr-dht/connection/ConnectionLockStates.hpp" -#include "streamr-dht/connection/ConnectionLocker.hpp" -#include "streamr-dht/connection/ConnectionManager.hpp" -#include "streamr-dht/connection/ConnectionsView.hpp" -#include "streamr-dht/connection/ConnectorFacade.hpp" -#include "streamr-dht/connection/Handshaker.hpp" -#include "streamr-dht/connection/IPendingConnection.hpp" -#include "streamr-dht/connection/IncomingHandshaker.hpp" -#include "streamr-dht/connection/OutgoingHandshaker.hpp" -#include "streamr-dht/connection/PendingConnection.hpp" -#include "streamr-dht/connection/endpoint/ConnectedEndpointState.hpp" -#include "streamr-dht/connection/endpoint/ConnectingEndpointState.hpp" -#include "streamr-dht/connection/endpoint/DisconnectedEndpointState.hpp" -#include "streamr-dht/connection/endpoint/Endpoint.hpp" -#include "streamr-dht/connection/endpoint/EndpointState.hpp" -#include "streamr-dht/connection/endpoint/EndpointStateInterface.hpp" -#include "streamr-dht/connection/endpoint/InitialEndpointState.hpp" -#include "streamr-dht/connection/websocket/WebsocketClientConnection.hpp" -#include "streamr-dht/connection/websocket/WebsocketClientConnector.hpp" -#include "streamr-dht/connection/websocket/WebsocketClientConnectorRpcLocal.hpp" -#include "streamr-dht/connection/websocket/WebsocketClientConnectorRpcRemote.hpp" -#include "streamr-dht/connection/websocket/WebsocketConnection.hpp" -#include "streamr-dht/connection/websocket/WebsocketServer.hpp" -#include "streamr-dht/connection/websocket/WebsocketServerConnection.hpp" -#include "streamr-dht/connection/websocket/WebsocketServerConnector.hpp" -#include "streamr-dht/dht/contact/RpcRemote.hpp" -#include "streamr-dht/dht/routing/DuplicateDetector.hpp" -#include "streamr-dht/helpers/AddressTools.hpp" -#include "streamr-dht/helpers/CertificateHelper.hpp" -#include "streamr-dht/helpers/Connectivity.hpp" -#include "streamr-dht/helpers/Errors.hpp" -#include "streamr-dht/helpers/Offerer.hpp" -#include "streamr-dht/helpers/Version.hpp" -#include "streamr-dht/rpc-protocol/DhtCallContext.hpp" -#include "streamr-dht/transport/FakeTransport.hpp" -#include "streamr-dht/transport/ListeningRpcCommunicator.hpp" -#include "streamr-dht/transport/RoutingRpcCommunicator.hpp" -#include "streamr-dht/transport/Transport.hpp" -#include "streamr-dht/types/NatType.hpp" -#include "streamr-dht/types/PortRange.hpp" -#include "streamr-dht/types/TlsCertificateFiles.hpp" - -export module streamr.dht:all; - -export namespace streamr::dht { - -using streamr::dht::DhtAddress; -using streamr::dht::DhtAddressRaw; -using streamr::dht::Identifiers; -using streamr::dht::kademliaIdLengthInBytes; -using streamr::dht::ServiceID; - -} // namespace streamr::dht - -export namespace streamr::dht::connection::connectionevents { - -using streamr::dht::connection::connectionevents::Connected; -using streamr::dht::connection::connectionevents::Data; -using streamr::dht::connection::connectionevents::Disconnected; -using streamr::dht::connection::connectionevents::Error; - -} // namespace streamr::dht::connection::connectionevents - -export namespace streamr::dht::connection { - -using streamr::dht::connection::Connection; -using streamr::dht::connection::ConnectionEvents; -using streamr::dht::connection::ConnectionID; -using streamr::dht::connection::ConnectionType; -using streamr::dht::connection::Url; - -} // namespace streamr::dht::connection - -export namespace streamr::dht::connection { - -using streamr::dht::connection::ConnectionLockRpcLocal; -using streamr::dht::connection::ConnectionLockRpcLocalOptions; - -} // namespace streamr::dht::connection - -export namespace streamr::dht::connection { - -using streamr::dht::connection::ConnectionLockRpcClient; -using streamr::dht::connection::ConnectionLockRpcRemote; - -} // namespace streamr::dht::connection - -export namespace streamr::dht::connection { - -using streamr::dht::connection::ConnectionLockStates; -using streamr::dht::connection::DhtAddress; -using streamr::dht::connection::LockID; - -} // namespace streamr::dht::connection - -export namespace streamr::dht::connection { - -using streamr::dht::connection::ConnectionLocker; - -} // namespace streamr::dht::connection - -export namespace streamr::dht::connection { - -using streamr::dht::connection::ConnectionManager; -using streamr::dht::connection::ConnectionManagerOptions; -using streamr::dht::connection::ConnectionManagerState; - -} // namespace streamr::dht::connection - -export namespace streamr::dht::connection { - -using streamr::dht::connection::ConnectionsView; - -} // namespace streamr::dht::connection - -export namespace streamr::dht::connection { - -using streamr::dht::connection::ConnectorFacade; -using streamr::dht::connection::DefaultConnectorFacade; -using streamr::dht::connection::DefaultConnectorFacadeOptions; - -} // namespace streamr::dht::connection - -export namespace streamr::dht::connection::handshakerevents { - -using streamr::dht::connection::handshakerevents::HandshakeCompleted; -using streamr::dht::connection::handshakerevents::HandshakeFailed; -using streamr::dht::connection::handshakerevents::HandshakerStopped; - -} // namespace streamr::dht::connection::handshakerevents - -export namespace streamr::dht::connection { - -using streamr::dht::connection::Handshaker; -using streamr::dht::connection::HandshakerEvents; - -} // namespace streamr::dht::connection - -export namespace streamr::dht::connection::pendingconnectionevents { - -using streamr::dht::connection::pendingconnectionevents::Connected; -using streamr::dht::connection::pendingconnectionevents::Disconnected; - -} // namespace streamr::dht::connection::pendingconnectionevents - -export namespace streamr::dht::connection { - -using streamr::dht::connection::IPendingConnection; -using streamr::dht::connection::PendingConnectionEvents; - -} // namespace streamr::dht::connection - -export namespace streamr::dht::connection { - -using streamr::dht::connection::IncomingHandshaker; - -} // namespace streamr::dht::connection - -export namespace streamr::dht::connection { - -using streamr::dht::connection::OutgoingHandshaker; - -} // namespace streamr::dht::connection - -export namespace streamr::dht::connection { - -using streamr::dht::connection::PendingConnection; - -} // namespace streamr::dht::connection - -export namespace streamr::dht::connection::endpoint { - -using streamr::dht::connection::endpoint::ConnectedEndpointState; - -} // namespace streamr::dht::connection::endpoint - -export namespace streamr::dht::connection::endpoint { - -using streamr::dht::connection::endpoint::ConnectingEndpointState; - -} // namespace streamr::dht::connection::endpoint - -export namespace streamr::dht::connection::endpoint { - -using streamr::dht::connection::endpoint::DisconnectedEndpointState; - -} // namespace streamr::dht::connection::endpoint - -export namespace streamr::dht::connection::endpoint::endpointevents { - -using streamr::dht::connection::endpoint::endpointevents::Connected; -using streamr::dht::connection::endpoint::endpointevents::Data; -using streamr::dht::connection::endpoint::endpointevents::Disconnected; - -} // namespace streamr::dht::connection::endpoint::endpointevents - -export namespace streamr::dht::connection::endpoint { - -using streamr::dht::connection::endpoint::Endpoint; -using streamr::dht::connection::endpoint::EndpointEvents; - -} // namespace streamr::dht::connection::endpoint - -export namespace streamr::dht::connection::endpoint { - -using streamr::dht::connection::endpoint::EndpointState; - -} // namespace streamr::dht::connection::endpoint - -export namespace streamr::dht::connection::endpoint { - -using streamr::dht::connection::endpoint::EndpointStateInterface; - -} // namespace streamr::dht::connection::endpoint - -export namespace streamr::dht::connection::endpoint { - -using streamr::dht::connection::endpoint::InitialEndpointState; - -} // namespace streamr::dht::connection::endpoint - -export namespace streamr::dht::connection::websocket { - -using streamr::dht::connection::websocket::WebsocketClientConnection; - -} // namespace streamr::dht::connection::websocket - -export namespace streamr::dht::connection::websocket { - -using streamr::dht::connection::websocket::WebsocketClientConnector; -using streamr::dht::connection::websocket::WebsocketClientConnectorOptions; - -} // namespace streamr::dht::connection::websocket - -export namespace streamr::dht::connection::websocket { - -using streamr::dht::connection::websocket::WebsocketClientConnectorRpcLocal; -using streamr::dht::connection::websocket:: - WebsocketClientConnectorRpcLocalOptions; - -} // namespace streamr::dht::connection::websocket - -export namespace streamr::dht::connection::websocket { - -using streamr::dht::connection::websocket::WebsocketClientConnectorRpcRemote; - -} // namespace streamr::dht::connection::websocket - -export namespace streamr::dht::connection::websocket { - -using streamr::dht::connection::websocket::maxMessageSize; -using streamr::dht::connection::websocket::WebsocketConnection; - -} // namespace streamr::dht::connection::websocket - -export namespace streamr::dht::connection::websocket::websocketserverevents { - -using streamr::dht::connection::websocket::websocketserverevents::Connected; - -} // namespace streamr::dht::connection::websocket::websocketserverevents - -export namespace streamr::dht::connection::websocket { - -using streamr::dht::connection::websocket::defaultMaxMessageSize; -using streamr::dht::connection::websocket::WebsocketServer; -using streamr::dht::connection::websocket::WebsocketServerConfig; -using streamr::dht::connection::websocket::WebsocketServerEvents; - -} // namespace streamr::dht::connection::websocket - -export namespace streamr::dht::connection::websocket { - -using streamr::dht::connection::websocket::WebsocketServerConnection; - -} // namespace streamr::dht::connection::websocket - -export namespace streamr::dht::connection::websocket { - -using streamr::dht::connection::websocket::WebsocketServerConnector; -using streamr::dht::connection::websocket::WebsocketServerConnectorOptions; - -} // namespace streamr::dht::connection::websocket - -export namespace streamr::dht::contact { - -using streamr::dht::contact::RpcRemote; - -} // namespace streamr::dht::contact - -export namespace streamr::dht::routing { - -using streamr::dht::routing::DuplicateDetector; - -} // namespace streamr::dht::routing - -export namespace streamr::dht::helpers { - -using streamr::dht::helpers::AddressTools; - -} // namespace streamr::dht::helpers - -export namespace streamr::dht::helpers { - -using streamr::dht::helpers::ASN1_TIME_ptr; -using streamr::dht::helpers::BIO_ptr; -using streamr::dht::helpers::CertificateHelper; -using streamr::dht::helpers::rsaKeyLength; -using streamr::dht::helpers::TlsCertificate; -using streamr::dht::helpers::X509_ptr; - -} // namespace streamr::dht::helpers - -export namespace streamr::dht::helpers { - -using streamr::dht::helpers::Connectivity; - -} // namespace streamr::dht::helpers - -export namespace streamr::dht::helpers { - -using streamr::dht::helpers::CannotConnectToSelf; -using streamr::dht::helpers::CouldNotStart; -using streamr::dht::helpers::DhtException; -using streamr::dht::helpers::Err; -using streamr::dht::helpers::ErrorCode; -using streamr::dht::helpers::SendFailed; -using streamr::dht::helpers::WebsocketServerStartError; - -} // namespace streamr::dht::helpers - -export namespace streamr::dht::helpers { - -using streamr::dht::helpers::Offerer; -using streamr::dht::helpers::OffererHelper; - -} // namespace streamr::dht::helpers - -export namespace streamr::dht::helpers { - -using streamr::dht::helpers::Version; -using streamr::dht::helpers::VersionNumber; - -} // namespace streamr::dht::helpers - -export namespace streamr::dht::rpcprotocol { - -using streamr::dht::rpcprotocol::DhtCallContext; - -} // namespace streamr::dht::rpcprotocol - -export namespace streamr::dht::transport { - -using streamr::dht::transport::FakeEnvironment; -using streamr::dht::transport::FakeTransport; - -} // namespace streamr::dht::transport - -export namespace streamr::dht::transport { - -using streamr::dht::transport::ListeningRpcCommunicator; - -} // namespace streamr::dht::transport - -export namespace streamr::dht::transport { - -using streamr::dht::transport::RoutingRpcCommunicator; -using streamr::dht::transport::RpcCommunicator; - -} // namespace streamr::dht::transport - -export namespace streamr::dht::transport::transportevents { - -using streamr::dht::transport::transportevents::Connected; -using streamr::dht::transport::transportevents::Disconnected; -using streamr::dht::transport::transportevents::Message; - -} // namespace streamr::dht::transport::transportevents - -export namespace streamr::dht::transport { - -using streamr::dht::transport::SendOptions; -using streamr::dht::transport::Transport; -using streamr::dht::transport::TransportEvents; - -} // namespace streamr::dht::transport - -export namespace streamr::dht::types::NatType { - -using streamr::dht::types::NatType::OPEN_INTERNET; -using streamr::dht::types::NatType::UNKNOWN; - -} // namespace streamr::dht::types::NatType - -export namespace streamr::dht::types { - -using streamr::dht::types::PortRange; - -} // namespace streamr::dht::types - -export namespace streamr::dht::types { - -using streamr::dht::types::TlsCertificateFiles; - -} // namespace streamr::dht::types diff --git a/packages/streamr-dht/modules/streamr.dht-protos.cppm b/packages/streamr-dht/modules/streamr.dht-protos.cppm index b13c0cd2..b84c3384 100644 --- a/packages/streamr-dht/modules/streamr.dht-protos.cppm +++ b/packages/streamr-dht/modules/streamr.dht-protos.cppm @@ -10,7 +10,7 @@ module; #include "packages/dht/protos/DhtRpc.pb.h" #include "packages/dht/protos/DhtRpc.server.pb.h" -export module streamr.dht:protos; +export module streamr.dht.protos; export namespace dht { diff --git a/packages/streamr-dht/modules/streamr.dht.cppm b/packages/streamr-dht/modules/streamr.dht.cppm deleted file mode 100644 index 668f6199..00000000 --- a/packages/streamr-dht/modules/streamr.dht.cppm +++ /dev/null @@ -1,5 +0,0 @@ -// Primary module interface unit of streamr.dht. -export module streamr.dht; - -export import :protos; -export import :all; diff --git a/packages/streamr-dht/include/streamr-dht/transport/FakeTransport.hpp b/packages/streamr-dht/modules/transport/FakeTransport.cppm similarity index 89% rename from packages/streamr-dht/include/streamr-dht/transport/FakeTransport.hpp rename to packages/streamr-dht/modules/transport/FakeTransport.cppm index 2429d56b..1ef1b4ab 100644 --- a/packages/streamr-dht/include/streamr-dht/transport/FakeTransport.hpp +++ b/packages/streamr-dht/modules/transport/FakeTransport.cppm @@ -1,15 +1,22 @@ -#ifndef STREAMR_DHT_FAKE_TRANSPORT_HPP -#define STREAMR_DHT_FAKE_TRANSPORT_HPP +// Module streamr.dht.FakeTransport +// CONSOLIDATED from the former header streamr-dht/transport/FakeTransport.hpp +// (MODERNIZATION.md Phase 2.6): this file is now the source of truth. +module; + #include #include #include #include #include "packages/dht/protos/DhtRpc.pb.h" -#include "streamr-dht/Identifiers.hpp" -#include "streamr-dht/connection/ConnectionsView.hpp" -#include "streamr-dht/transport/Transport.hpp" -namespace streamr::dht::transport { +#include + +export module streamr.dht.FakeTransport; + +import streamr.dht.ConnectionsView; +import streamr.dht.Identifiers; +import streamr.dht.Transport; +export namespace streamr::dht::transport { using ::dht::Message; using ::dht::PeerDescriptor; @@ -105,5 +112,3 @@ class FakeEnvironment { }; } // namespace streamr::dht::transport - -#endif // STREAMR_DHT_FAKE_TRANSPORT_HPP diff --git a/packages/streamr-dht/include/streamr-dht/transport/ListeningRpcCommunicator.hpp b/packages/streamr-dht/modules/transport/ListeningRpcCommunicator.cppm similarity index 73% rename from packages/streamr-dht/include/streamr-dht/transport/ListeningRpcCommunicator.hpp rename to packages/streamr-dht/modules/transport/ListeningRpcCommunicator.cppm index 0c0d7e38..4d5ef704 100644 --- a/packages/streamr-dht/include/streamr-dht/transport/ListeningRpcCommunicator.hpp +++ b/packages/streamr-dht/modules/transport/ListeningRpcCommunicator.cppm @@ -1,16 +1,32 @@ -#ifndef STREAMR_DHT_TRANSPORT_LISTENINGRPCCOMMUNICATOR_HPP -#define STREAMR_DHT_TRANSPORT_LISTENINGRPCCOMMUNICATOR_HPP +// Module streamr.dht.ListeningRpcCommunicator +// CONSOLIDATED from the former header +// streamr-dht/transport/ListeningRpcCommunicator.hpp (MODERNIZATION.md +// Phase 2.6): this file is now the source of truth. +module; #include "packages/dht/protos/DhtRpc.pb.h" -#include "streamr-dht/transport/RoutingRpcCommunicator.hpp" -#include "streamr-dht/transport/Transport.hpp" -#include "streamr-eventemitter/EventEmitter.hpp" -#include "streamr-proto-rpc/Errors.hpp" -namespace streamr::dht::transport { -using ::dht::PeerDescriptor; -using eventemitter::HandlerToken; +#include + +export module streamr.dht.ListeningRpcCommunicator; + +import streamr.eventemitter; +import streamr.protorpc; +import streamr.dht.RoutingRpcCommunicator; +import streamr.dht.Transport; + +// Hoisted from the former header (file scope, NOT exported); +// fully qualified: relative namespace names resolve differently +// at file scope than inside the package namespace. +using streamr::eventemitter::HandlerToken; using streamr::protorpc::RpcClientError; +// Self-sufficient shorthand (was inherited textually from a +// neighboring header before consolidation). +using streamr::protorpc::RpcCommunicatorOptions; + +export namespace streamr::dht::transport { + +using ::dht::PeerDescriptor; class ListeningRpcCommunicator : public RoutingRpcCommunicator { private: @@ -65,5 +81,3 @@ class ListeningRpcCommunicator : public RoutingRpcCommunicator { }; } // namespace streamr::dht::transport - -#endif // STREAMR_DHT_TRANSPORT_LISTENINGRPCCOMMUNICATOR_HPP \ No newline at end of file diff --git a/packages/streamr-dht/include/streamr-dht/transport/RoutingRpcCommunicator.hpp b/packages/streamr-dht/modules/transport/RoutingRpcCommunicator.cppm similarity index 87% rename from packages/streamr-dht/include/streamr-dht/transport/RoutingRpcCommunicator.hpp rename to packages/streamr-dht/modules/transport/RoutingRpcCommunicator.cppm index b4956631..f57bbc08 100644 --- a/packages/streamr-dht/include/streamr-dht/transport/RoutingRpcCommunicator.hpp +++ b/packages/streamr-dht/modules/transport/RoutingRpcCommunicator.cppm @@ -1,16 +1,30 @@ -#ifndef STREAMR_DHT_TRANSPORT_ROUTINGRPCCOMMUNICATOR_HPP -#define STREAMR_DHT_TRANSPORT_ROUTINGRPCCOMMUNICATOR_HPP +// Module streamr.dht.RoutingRpcCommunicator +// CONSOLIDATED from the former header +// streamr-dht/transport/RoutingRpcCommunicator.hpp (MODERNIZATION.md +// Phase 2.6): this file is now the source of truth. +module; #include "packages/dht/protos/DhtRpc.pb.h" #include "packages/proto-rpc/protos/ProtoRpc.pb.h" -#include "streamr-dht/Identifiers.hpp" -#include "streamr-dht/rpc-protocol/DhtCallContext.hpp" -#include "streamr-dht/transport/Transport.hpp" -#include "streamr-logger/SLogger.hpp" -#include "streamr-proto-rpc/RpcCommunicator.hpp" -#include "streamr-utils/Uuid.hpp" -namespace streamr::dht::transport { +#include + +export module streamr.dht.RoutingRpcCommunicator; + +import streamr.logger; +import streamr.protorpc; +import streamr.utils; +import streamr.dht.DhtCallContext; +import streamr.dht.Identifiers; +import streamr.dht.Transport; + +// Hoisted from the former header (file scope, NOT exported); +// fully qualified: relative namespace names resolve differently +// at file scope than inside the package namespace. +using streamr::logger::SLogger; +using streamr::protorpc::RpcCommunicatorOptions; +using streamr::utils::Uuid; +export namespace streamr::dht::transport { using ::dht::Message; using ::protorpc::RpcMessage; @@ -18,9 +32,6 @@ using streamr::dht::ServiceID; using streamr::dht::rpcprotocol::DhtCallContext; using streamr::dht::transport::SendOptions; using RpcCommunicator = streamr::protorpc::RpcCommunicator; -using streamr::logger::SLogger; -using streamr::protorpc::RpcCommunicatorOptions; -using streamr::utils::Uuid; class RoutingRpcCommunicator : public RpcCommunicator { private: @@ -114,5 +125,3 @@ class RoutingRpcCommunicator : public RpcCommunicator { }; } // namespace streamr::dht::transport - -#endif // STREAMR_DHT_TRANSPORT_ROUTINGRPCCOMMUNICATOR_HPP \ No newline at end of file diff --git a/packages/streamr-dht/include/streamr-dht/transport/Transport.hpp b/packages/streamr-dht/modules/transport/Transport.cppm similarity index 65% rename from packages/streamr-dht/include/streamr-dht/transport/Transport.hpp rename to packages/streamr-dht/modules/transport/Transport.cppm index 12b0b7fd..255bdec7 100644 --- a/packages/streamr-dht/include/streamr-dht/transport/Transport.hpp +++ b/packages/streamr-dht/modules/transport/Transport.cppm @@ -1,17 +1,25 @@ -#ifndef STREAMR_DHT_TRANSPORT_CONNECTION_HPP -#define STREAMR_DHT_TRANSPORT_CONNECTION_HPP +// Module streamr.dht.Transport +// CONSOLIDATED from the former header streamr-dht/transport/Transport.hpp +// (MODERNIZATION.md Phase 2.6): this file is now the source of truth. +module; #include - #include "packages/dht/protos/DhtRpc.pb.h" -#include "streamr-dht/helpers/Errors.hpp" -#include "streamr-eventemitter/EventEmitter.hpp" -namespace streamr::dht::transport { -using ::dht::PeerDescriptor; -using streamr::dht::helpers::Err; +export module streamr.dht.Transport; + +import streamr.eventemitter; +import streamr.dht.Errors; + +// Hoisted from the former header (file scope, NOT exported); +// fully qualified: relative namespace names resolve differently +// at file scope than inside the package namespace. using streamr::eventemitter::Event; using streamr::eventemitter::EventEmitter; +export namespace streamr::dht::transport { + +using ::dht::PeerDescriptor; +using streamr::dht::helpers::Err; struct SendOptions { bool connect = true; bool sendIfStopped = false; @@ -41,5 +49,3 @@ class Transport : public EventEmitter { }; } // namespace streamr::dht::transport - -#endif // STREAMR_DHT_TRANSPORT_CONNECTION_HPP \ No newline at end of file diff --git a/packages/streamr-dht/modules/types/NatType.cppm b/packages/streamr-dht/modules/types/NatType.cppm new file mode 100644 index 00000000..5afd34d0 --- /dev/null +++ b/packages/streamr-dht/modules/types/NatType.cppm @@ -0,0 +1,12 @@ +// Module streamr.dht.NatType +// CONSOLIDATED from the former header streamr-dht/types/NatType.hpp +// (MODERNIZATION.md Phase 2.6): this file is now the source of truth. +export module streamr.dht.NatType; +// NOLINTBEGIN +export namespace streamr::dht::types::NatType { + +inline constexpr auto OPEN_INTERNET = "open_internet"; +inline constexpr auto UNKNOWN = "unknown"; + +} // namespace streamr::dht::types::NatType +// NOLINTEND diff --git a/packages/streamr-dht/modules/types/PortRange.cppm b/packages/streamr-dht/modules/types/PortRange.cppm new file mode 100644 index 00000000..ccb1785e --- /dev/null +++ b/packages/streamr-dht/modules/types/PortRange.cppm @@ -0,0 +1,16 @@ +// Module streamr.dht.PortRange +// CONSOLIDATED from the former header streamr-dht/types/PortRange.hpp +// (MODERNIZATION.md Phase 2.6): this file is now the source of truth. +module; + +#include + +export module streamr.dht.PortRange; +export namespace streamr::dht::types { + +struct PortRange { + uint16_t min; + uint16_t max; +}; + +} // namespace streamr::dht::types diff --git a/packages/streamr-dht/modules/types/TlsCertificateFiles.cppm b/packages/streamr-dht/modules/types/TlsCertificateFiles.cppm new file mode 100644 index 00000000..25f5c7b7 --- /dev/null +++ b/packages/streamr-dht/modules/types/TlsCertificateFiles.cppm @@ -0,0 +1,16 @@ +// Module streamr.dht.TlsCertificateFiles +// CONSOLIDATED from the former header streamr-dht/types/TlsCertificateFiles.hpp +// (MODERNIZATION.md Phase 2.6): this file is now the source of truth. +module; + +#include + +export module streamr.dht.TlsCertificateFiles; +export namespace streamr::dht::types { + +struct TlsCertificateFiles { + std::string privateKeyFileName; + std::string certFileName; +}; + +} // namespace streamr::dht::types diff --git a/packages/streamr-dht/test/integration/ConnectionLockingTest.cpp b/packages/streamr-dht/test/integration/ConnectionLockingTest.cpp index 9eba0d8e..758a1a3b 100644 --- a/packages/streamr-dht/test/integration/ConnectionLockingTest.cpp +++ b/packages/streamr-dht/test/integration/ConnectionLockingTest.cpp @@ -3,10 +3,21 @@ #include #include #include +// Collect.h textually: this TU instantiates streamr::utils::collect +// (imported), whose body calls folly::coro::collectAll - the folly +// machinery must be textually visible at the instantiation point. +#include #include #include "packages/dht/protos/DhtRpc.pb.h" -import streamr.dht; +import streamr.dht.ConnectionLockStates; +import streamr.dht.ConnectionManager; +import streamr.dht.ConnectorFacade; +import streamr.dht.FakeTransport; +import streamr.dht.Identifiers; +import streamr.dht.PortRange; +import streamr.dht.Transport; +import streamr.dht.protos; import streamr.logger; import streamr.utils; diff --git a/packages/streamr-dht/test/integration/WebsocketClientServerTest.cpp b/packages/streamr-dht/test/integration/WebsocketClientServerTest.cpp index 2496cf5e..6fb01f5b 100644 --- a/packages/streamr-dht/test/integration/WebsocketClientServerTest.cpp +++ b/packages/streamr-dht/test/integration/WebsocketClientServerTest.cpp @@ -2,7 +2,11 @@ #include #include -import streamr.dht; +import streamr.dht.Connection; +import streamr.dht.Transport; +import streamr.dht.WebsocketClientConnection; +import streamr.dht.WebsocketServer; +import streamr.dht.WebsocketServerConnection; import streamr.logger; using streamr::dht::connection::connectionevents::Connected; diff --git a/packages/streamr-dht/test/unit/AddressToolsTest.cpp b/packages/streamr-dht/test/unit/AddressToolsTest.cpp index affc02d6..a6da5452 100644 --- a/packages/streamr-dht/test/unit/AddressToolsTest.cpp +++ b/packages/streamr-dht/test/unit/AddressToolsTest.cpp @@ -1,6 +1,6 @@ #include -import streamr.dht; +import streamr.dht.AddressTools; using streamr::dht::helpers::AddressTools; diff --git a/packages/streamr-dht/test/unit/CertificateHelperTest.cpp b/packages/streamr-dht/test/unit/CertificateHelperTest.cpp index f6546868..b8c1e980 100644 --- a/packages/streamr-dht/test/unit/CertificateHelperTest.cpp +++ b/packages/streamr-dht/test/unit/CertificateHelperTest.cpp @@ -1,6 +1,6 @@ #include -import streamr.dht; +import streamr.dht.CertificateHelper; import streamr.logger; using streamr::dht::helpers::CertificateHelper; diff --git a/packages/streamr-dht/test/unit/ConnectedEndpointStateTest.cpp b/packages/streamr-dht/test/unit/ConnectedEndpointStateTest.cpp index c3b4f8af..7fe15871 100644 --- a/packages/streamr-dht/test/unit/ConnectedEndpointStateTest.cpp +++ b/packages/streamr-dht/test/unit/ConnectedEndpointStateTest.cpp @@ -1,6 +1,6 @@ #include -import streamr.dht; +import streamr.dht.ConnectedEndpointState; using streamr::dht::connection::endpoint::ConnectedEndpointState; // NOLINT diff --git a/packages/streamr-dht/test/unit/ConnectingEndpointStateTest.cpp b/packages/streamr-dht/test/unit/ConnectingEndpointStateTest.cpp index 1248b97e..2fca916c 100644 --- a/packages/streamr-dht/test/unit/ConnectingEndpointStateTest.cpp +++ b/packages/streamr-dht/test/unit/ConnectingEndpointStateTest.cpp @@ -1,6 +1,6 @@ #include -import streamr.dht; +import streamr.dht.ConnectingEndpointState; using streamr::dht::connection::endpoint::ConnectingEndpointState; // NOLINT diff --git a/packages/streamr-dht/test/unit/ConnectionLockRpcLocalTest.cpp b/packages/streamr-dht/test/unit/ConnectionLockRpcLocalTest.cpp index d9bcb12e..a87eb5ab 100644 --- a/packages/streamr-dht/test/unit/ConnectionLockRpcLocalTest.cpp +++ b/packages/streamr-dht/test/unit/ConnectionLockRpcLocalTest.cpp @@ -1,6 +1,6 @@ #include -import streamr.dht; +import streamr.dht.ConnectionLockRpcLocal; using streamr::dht::connection::ConnectionLockRpcLocal; // NOLINT diff --git a/packages/streamr-dht/test/unit/ConnectionLockRpcRemoteTest.cpp b/packages/streamr-dht/test/unit/ConnectionLockRpcRemoteTest.cpp index 51692b08..c0e72815 100644 --- a/packages/streamr-dht/test/unit/ConnectionLockRpcRemoteTest.cpp +++ b/packages/streamr-dht/test/unit/ConnectionLockRpcRemoteTest.cpp @@ -1,6 +1,6 @@ #include -import streamr.dht; +import streamr.dht.ConnectionLockRpcRemote; using streamr::dht::connection::ConnectionLockRpcRemote; // NOLINT diff --git a/packages/streamr-dht/test/unit/ConnectionLockStatesTest.cpp b/packages/streamr-dht/test/unit/ConnectionLockStatesTest.cpp index 37a9b9b9..59d9b0ac 100644 --- a/packages/streamr-dht/test/unit/ConnectionLockStatesTest.cpp +++ b/packages/streamr-dht/test/unit/ConnectionLockStatesTest.cpp @@ -1,6 +1,6 @@ #include -import streamr.dht; +import streamr.dht.ConnectionLockStates; using streamr::dht::connection::ConnectionLockStates; // NOLINT diff --git a/packages/streamr-dht/test/unit/ConnectionLockerTest.cpp b/packages/streamr-dht/test/unit/ConnectionLockerTest.cpp index c95e3040..4b024e8f 100644 --- a/packages/streamr-dht/test/unit/ConnectionLockerTest.cpp +++ b/packages/streamr-dht/test/unit/ConnectionLockerTest.cpp @@ -1,6 +1,6 @@ #include -import streamr.dht; +import streamr.dht.ConnectionLocker; using streamr::dht::connection::ConnectionLocker; // NOLINT diff --git a/packages/streamr-dht/test/unit/ConnectionManagerTest.cpp b/packages/streamr-dht/test/unit/ConnectionManagerTest.cpp index 94767fb0..ce9de61e 100644 --- a/packages/streamr-dht/test/unit/ConnectionManagerTest.cpp +++ b/packages/streamr-dht/test/unit/ConnectionManagerTest.cpp @@ -8,7 +8,13 @@ #include "packages/dht/protos/DhtRpc.pb.h" #include "packages/proto-rpc/protos/ProtoRpc.pb.h" -import streamr.dht; +import streamr.dht.ConnectionManager; +import streamr.dht.ConnectorFacade; +import streamr.dht.Errors; +import streamr.dht.FakeTransport; +import streamr.dht.PortRange; +import streamr.dht.Transport; +import streamr.dht.protos; import streamr.logger; using ::dht::ConnectivityResponse; diff --git a/packages/streamr-dht/test/unit/ConnectionsViewTest.cpp b/packages/streamr-dht/test/unit/ConnectionsViewTest.cpp index edc7910d..519b4569 100644 --- a/packages/streamr-dht/test/unit/ConnectionsViewTest.cpp +++ b/packages/streamr-dht/test/unit/ConnectionsViewTest.cpp @@ -1,6 +1,6 @@ #include -import streamr.dht; +import streamr.dht.ConnectionsView; using streamr::dht::connection::ConnectionsView; // NOLINT diff --git a/packages/streamr-dht/test/unit/ConnectivityTest.cpp b/packages/streamr-dht/test/unit/ConnectivityTest.cpp index 3c4ab183..2ddcdfec 100644 --- a/packages/streamr-dht/test/unit/ConnectivityTest.cpp +++ b/packages/streamr-dht/test/unit/ConnectivityTest.cpp @@ -1,6 +1,8 @@ #include -import streamr.dht; +import streamr.dht.Connection; +import streamr.dht.Connectivity; +import streamr.dht.protos; using ::dht::NodeType; using ::dht::PeerDescriptor; diff --git a/packages/streamr-dht/test/unit/ConnectorFacadeTest.cpp b/packages/streamr-dht/test/unit/ConnectorFacadeTest.cpp index 7a3fb25a..d8531aee 100644 --- a/packages/streamr-dht/test/unit/ConnectorFacadeTest.cpp +++ b/packages/streamr-dht/test/unit/ConnectorFacadeTest.cpp @@ -1,6 +1,6 @@ #include -import streamr.dht; +import streamr.dht.ConnectorFacade; using streamr::dht::connection::ConnectorFacade; // NOLINT diff --git a/packages/streamr-dht/test/unit/DhtCallContextTest.cpp b/packages/streamr-dht/test/unit/DhtCallContextTest.cpp index d33bd286..f2a9b750 100644 --- a/packages/streamr-dht/test/unit/DhtCallContextTest.cpp +++ b/packages/streamr-dht/test/unit/DhtCallContextTest.cpp @@ -1,6 +1,6 @@ #include -import streamr.dht; +import streamr.dht.DhtCallContext; using streamr::dht::rpcprotocol::DhtCallContext; // NOLINT diff --git a/packages/streamr-dht/test/unit/DisconnectedEndpointStateTest.cpp b/packages/streamr-dht/test/unit/DisconnectedEndpointStateTest.cpp index 70938fa4..8964c814 100644 --- a/packages/streamr-dht/test/unit/DisconnectedEndpointStateTest.cpp +++ b/packages/streamr-dht/test/unit/DisconnectedEndpointStateTest.cpp @@ -1,6 +1,6 @@ #include -import streamr.dht; +import streamr.dht.DisconnectedEndpointState; using streamr::dht::connection::endpoint::DisconnectedEndpointState; // NOLINT diff --git a/packages/streamr-dht/test/unit/DuplicateDetectorTest.cpp b/packages/streamr-dht/test/unit/DuplicateDetectorTest.cpp index 4675c8ab..eb05798b 100644 --- a/packages/streamr-dht/test/unit/DuplicateDetectorTest.cpp +++ b/packages/streamr-dht/test/unit/DuplicateDetectorTest.cpp @@ -1,7 +1,7 @@ #include #include -import streamr.dht; +import streamr.dht.DuplicateDetector; using streamr::dht::routing::DuplicateDetector; diff --git a/packages/streamr-dht/test/unit/EndpointStateInterfaceTest.cpp b/packages/streamr-dht/test/unit/EndpointStateInterfaceTest.cpp index 5251b718..174579ce 100644 --- a/packages/streamr-dht/test/unit/EndpointStateInterfaceTest.cpp +++ b/packages/streamr-dht/test/unit/EndpointStateInterfaceTest.cpp @@ -1,6 +1,6 @@ #include -import streamr.dht; +import streamr.dht.EndpointStateInterface; using streamr::dht::connection::endpoint::EndpointStateInterface; // NOLINT diff --git a/packages/streamr-dht/test/unit/EndpointStateTest.cpp b/packages/streamr-dht/test/unit/EndpointStateTest.cpp index 9adebfca..43bce1f1 100644 --- a/packages/streamr-dht/test/unit/EndpointStateTest.cpp +++ b/packages/streamr-dht/test/unit/EndpointStateTest.cpp @@ -1,6 +1,6 @@ #include -import streamr.dht; +import streamr.dht.EndpointState; using streamr::dht::connection::endpoint::EndpointState; // NOLINT diff --git a/packages/streamr-dht/test/unit/EndpointTest.cpp b/packages/streamr-dht/test/unit/EndpointTest.cpp index d46c709a..f071c82d 100644 --- a/packages/streamr-dht/test/unit/EndpointTest.cpp +++ b/packages/streamr-dht/test/unit/EndpointTest.cpp @@ -1,6 +1,6 @@ #include -import streamr.dht; +import streamr.dht.Endpoint; using streamr::dht::connection::endpoint::Endpoint; // NOLINT diff --git a/packages/streamr-dht/test/unit/FakeTransportTest.cpp b/packages/streamr-dht/test/unit/FakeTransportTest.cpp index 5c384fd5..23ce20c4 100644 --- a/packages/streamr-dht/test/unit/FakeTransportTest.cpp +++ b/packages/streamr-dht/test/unit/FakeTransportTest.cpp @@ -1,6 +1,6 @@ #include -import streamr.dht; +import streamr.dht.FakeTransport; using streamr::dht::transport::FakeTransport; // NOLINT diff --git a/packages/streamr-dht/test/unit/HandshakerTest.cpp b/packages/streamr-dht/test/unit/HandshakerTest.cpp index 668d7c01..553ac15b 100644 --- a/packages/streamr-dht/test/unit/HandshakerTest.cpp +++ b/packages/streamr-dht/test/unit/HandshakerTest.cpp @@ -2,7 +2,12 @@ #include #include -import streamr.dht; +import streamr.dht.Connection; +import streamr.dht.Handshaker; +import streamr.dht.IPendingConnection; +import streamr.dht.OutgoingHandshaker; +import streamr.dht.Transport; +import streamr.dht.protos; using ::dht::HandshakeError; using ::dht::PeerDescriptor; diff --git a/packages/streamr-dht/test/unit/IPendingConnectionTest.cpp b/packages/streamr-dht/test/unit/IPendingConnectionTest.cpp index d2620f2c..2ec82ffb 100644 --- a/packages/streamr-dht/test/unit/IPendingConnectionTest.cpp +++ b/packages/streamr-dht/test/unit/IPendingConnectionTest.cpp @@ -1,6 +1,6 @@ #include -import streamr.dht; +import streamr.dht.IPendingConnection; using streamr::dht::connection::IPendingConnection; // NOLINT diff --git a/packages/streamr-dht/test/unit/IdentifiersTest.cpp b/packages/streamr-dht/test/unit/IdentifiersTest.cpp index 805c020a..183b9217 100644 --- a/packages/streamr-dht/test/unit/IdentifiersTest.cpp +++ b/packages/streamr-dht/test/unit/IdentifiersTest.cpp @@ -1,6 +1,6 @@ #include -import streamr.dht; +import streamr.dht.Identifiers; using streamr::dht::Identifiers; diff --git a/packages/streamr-dht/test/unit/IncomingHandshakerTest.cpp b/packages/streamr-dht/test/unit/IncomingHandshakerTest.cpp index 36d79fdf..167392a1 100644 --- a/packages/streamr-dht/test/unit/IncomingHandshakerTest.cpp +++ b/packages/streamr-dht/test/unit/IncomingHandshakerTest.cpp @@ -1,6 +1,6 @@ #include -import streamr.dht; +import streamr.dht.IncomingHandshaker; using streamr::dht::connection::IncomingHandshaker; // NOLINT diff --git a/packages/streamr-dht/test/unit/InitialEndpointStateTest.cpp b/packages/streamr-dht/test/unit/InitialEndpointStateTest.cpp index 292be13b..156367ce 100644 --- a/packages/streamr-dht/test/unit/InitialEndpointStateTest.cpp +++ b/packages/streamr-dht/test/unit/InitialEndpointStateTest.cpp @@ -1,6 +1,6 @@ #include -import streamr.dht; +import streamr.dht.InitialEndpointState; using streamr::dht::connection::endpoint::InitialEndpointState; // NOLINT diff --git a/packages/streamr-dht/test/unit/ListeningRpcCommunicatorTest.cpp b/packages/streamr-dht/test/unit/ListeningRpcCommunicatorTest.cpp index ef72f526..f3615c59 100644 --- a/packages/streamr-dht/test/unit/ListeningRpcCommunicatorTest.cpp +++ b/packages/streamr-dht/test/unit/ListeningRpcCommunicatorTest.cpp @@ -1,6 +1,6 @@ #include -import streamr.dht; +import streamr.dht.ListeningRpcCommunicator; using streamr::dht::transport::ListeningRpcCommunicator; // NOLINT diff --git a/packages/streamr-dht/test/unit/OffererTest.cpp b/packages/streamr-dht/test/unit/OffererTest.cpp index f6696e2b..c791b182 100644 --- a/packages/streamr-dht/test/unit/OffererTest.cpp +++ b/packages/streamr-dht/test/unit/OffererTest.cpp @@ -1,6 +1,6 @@ #include -import streamr.dht; +import streamr.dht.Offerer; using streamr::dht::helpers::Offerer; // NOLINT diff --git a/packages/streamr-dht/test/unit/OutgoingHandshakerTest.cpp b/packages/streamr-dht/test/unit/OutgoingHandshakerTest.cpp index aadc7139..c452fab2 100644 --- a/packages/streamr-dht/test/unit/OutgoingHandshakerTest.cpp +++ b/packages/streamr-dht/test/unit/OutgoingHandshakerTest.cpp @@ -1,6 +1,6 @@ #include -import streamr.dht; +import streamr.dht.OutgoingHandshaker; using streamr::dht::connection::OutgoingHandshaker; // NOLINT diff --git a/packages/streamr-dht/test/unit/PendingConnectionTest.cpp b/packages/streamr-dht/test/unit/PendingConnectionTest.cpp index d2d9f681..73065137 100644 --- a/packages/streamr-dht/test/unit/PendingConnectionTest.cpp +++ b/packages/streamr-dht/test/unit/PendingConnectionTest.cpp @@ -6,7 +6,11 @@ // (unmergeable) definitions with identical mangled names in Release. #include -import streamr.dht; +import streamr.dht.IPendingConnection; +import streamr.dht.Connection; +import streamr.dht.PendingConnection; +import streamr.dht.Transport; +import streamr.dht.protos; import streamr.utils; using ::dht::PeerDescriptor; diff --git a/packages/streamr-dht/test/unit/RoutingRpcCommunicatorTest.cpp b/packages/streamr-dht/test/unit/RoutingRpcCommunicatorTest.cpp index 9e57d64e..7a0bb174 100644 --- a/packages/streamr-dht/test/unit/RoutingRpcCommunicatorTest.cpp +++ b/packages/streamr-dht/test/unit/RoutingRpcCommunicatorTest.cpp @@ -1,6 +1,6 @@ #include -import streamr.dht; +import streamr.dht.RoutingRpcCommunicator; using streamr::dht::transport::RoutingRpcCommunicator; // NOLINT diff --git a/packages/streamr-dht/test/unit/TransportTest.cpp b/packages/streamr-dht/test/unit/TransportTest.cpp index 93a90364..0af9adc5 100644 --- a/packages/streamr-dht/test/unit/TransportTest.cpp +++ b/packages/streamr-dht/test/unit/TransportTest.cpp @@ -1,6 +1,6 @@ #include -import streamr.dht; +import streamr.dht.Transport; using streamr::dht::transport::Transport; // NOLINT diff --git a/packages/streamr-dht/test/unit/VersionTest.cpp b/packages/streamr-dht/test/unit/VersionTest.cpp index 8db20bc4..c967e78e 100644 --- a/packages/streamr-dht/test/unit/VersionTest.cpp +++ b/packages/streamr-dht/test/unit/VersionTest.cpp @@ -1,7 +1,7 @@ #include -import streamr.dht; +import streamr.dht.Version; using streamr::dht::helpers::Version; diff --git a/packages/streamr-dht/test/unit/WebsocketClientConnectionTest.cpp b/packages/streamr-dht/test/unit/WebsocketClientConnectionTest.cpp index 32dda0e9..6fb572cc 100644 --- a/packages/streamr-dht/test/unit/WebsocketClientConnectionTest.cpp +++ b/packages/streamr-dht/test/unit/WebsocketClientConnectionTest.cpp @@ -1,6 +1,6 @@ #include -import streamr.dht; +import streamr.dht.WebsocketClientConnection; using streamr::dht::connection::websocket::WebsocketClientConnection; diff --git a/packages/streamr-dht/test/unit/WebsocketClientConnectorRpcLocalTest.cpp b/packages/streamr-dht/test/unit/WebsocketClientConnectorRpcLocalTest.cpp index 03eb3531..fa9b8b92 100644 --- a/packages/streamr-dht/test/unit/WebsocketClientConnectorRpcLocalTest.cpp +++ b/packages/streamr-dht/test/unit/WebsocketClientConnectorRpcLocalTest.cpp @@ -1,6 +1,10 @@ #include -import streamr.dht; +import streamr.dht.IPendingConnection; +import streamr.dht.Identifiers; +import streamr.dht.PendingConnection; +import streamr.dht.WebsocketClientConnectorRpcLocal; +import streamr.dht.protos; import streamr.utils; using ::dht::PeerDescriptor; diff --git a/packages/streamr-dht/test/unit/WebsocketClientConnectorRpcRemoteTest.cpp b/packages/streamr-dht/test/unit/WebsocketClientConnectorRpcRemoteTest.cpp index a6ba50e0..26cc5bd6 100644 --- a/packages/streamr-dht/test/unit/WebsocketClientConnectorRpcRemoteTest.cpp +++ b/packages/streamr-dht/test/unit/WebsocketClientConnectorRpcRemoteTest.cpp @@ -1,6 +1,8 @@ #include -import streamr.dht; +import streamr.dht.DhtCallContext; +import streamr.dht.WebsocketClientConnectorRpcRemote; +import streamr.dht.protos; import streamr.protorpc; using ::dht::PeerDescriptor; diff --git a/packages/streamr-dht/test/unit/WebsocketClientConnectorTest.cpp b/packages/streamr-dht/test/unit/WebsocketClientConnectorTest.cpp index 8f9e43b3..f77f000e 100644 --- a/packages/streamr-dht/test/unit/WebsocketClientConnectorTest.cpp +++ b/packages/streamr-dht/test/unit/WebsocketClientConnectorTest.cpp @@ -2,7 +2,13 @@ #include #include "packages/dht/protos/DhtRpc.pb.h" -import streamr.dht; +import streamr.dht.Connection; +import streamr.dht.IPendingConnection; +import streamr.dht.Identifiers; +import streamr.dht.ListeningRpcCommunicator; +import streamr.dht.Transport; +import streamr.dht.WebsocketClientConnector; +import streamr.dht.protos; using ::dht::NodeType; using ::dht::PeerDescriptor; diff --git a/packages/streamr-dht/test/unit/WebsocketConnectionTest.cpp b/packages/streamr-dht/test/unit/WebsocketConnectionTest.cpp index 9d6ae669..5793c117 100644 --- a/packages/streamr-dht/test/unit/WebsocketConnectionTest.cpp +++ b/packages/streamr-dht/test/unit/WebsocketConnectionTest.cpp @@ -1,6 +1,6 @@ #include -import streamr.dht; +import streamr.dht.WebsocketConnection; using streamr::dht::connection::websocket::WebsocketConnection; // NOLINT diff --git a/packages/streamr-dht/test/unit/WebsocketServerConnectionTest.cpp b/packages/streamr-dht/test/unit/WebsocketServerConnectionTest.cpp index d0868e23..495fd0ca 100644 --- a/packages/streamr-dht/test/unit/WebsocketServerConnectionTest.cpp +++ b/packages/streamr-dht/test/unit/WebsocketServerConnectionTest.cpp @@ -2,7 +2,7 @@ #include #include "rtc/rtc.hpp" -import streamr.dht; +import streamr.dht.WebsocketServerConnection; using streamr::dht::connection::websocket::WebsocketServerConnection; diff --git a/packages/streamr-dht/test/unit/WebsocketServerConnectorTest.cpp b/packages/streamr-dht/test/unit/WebsocketServerConnectorTest.cpp index 5bf37eb3..8d668434 100644 --- a/packages/streamr-dht/test/unit/WebsocketServerConnectorTest.cpp +++ b/packages/streamr-dht/test/unit/WebsocketServerConnectorTest.cpp @@ -1,6 +1,6 @@ #include -import streamr.dht; +import streamr.dht.WebsocketServerConnector; using streamr::dht::connection::websocket::WebsocketServerConnector; // NOLINT diff --git a/packages/streamr-dht/test/unit/WebsocketServerTest.cpp b/packages/streamr-dht/test/unit/WebsocketServerTest.cpp index 86e305a5..fda05fd8 100644 --- a/packages/streamr-dht/test/unit/WebsocketServerTest.cpp +++ b/packages/streamr-dht/test/unit/WebsocketServerTest.cpp @@ -1,6 +1,8 @@ #include -import streamr.dht; +import streamr.dht.Errors; +import streamr.dht.TlsCertificateFiles; +import streamr.dht.WebsocketServer; using streamr::dht::connection::websocket::WebsocketServer; using streamr::dht::connection::websocket::WebsocketServerConfig; diff --git a/packages/streamr-eventemitter/StreamrModules.cmake b/packages/streamr-eventemitter/StreamrModules.cmake index 2bb5f1e6..04160292 100644 --- a/packages/streamr-eventemitter/StreamrModules.cmake +++ b/packages/streamr-eventemitter/StreamrModules.cmake @@ -120,6 +120,13 @@ function(streamr_add_module_library TARGET) # undeclared). Making the flag part of the PUBLIC interface keeps the # BMI and every importer consistent. No-op on other platforms. target_compile_options(${TARGET} PUBLIC $<$:-pthread>) + # The module libraries' objects end up inside the shared + # libstreamrproxyclient, so they must be position-independent. macOS + # emits PIC by default; on Linux the ELF linker rejects the archive + # otherwise ("recompile with -fPIC" against the module vtable/thunk + # symbols — first seen when the consolidated code moved into module + # objects on the linux-arm64 leg). + set_target_properties(${TARGET} PROPERTIES POSITION_INDEPENDENT_CODE ON) endfunction() # streamr_target_module_sources( FILES ...) @@ -143,8 +150,10 @@ function(streamr_target_module_sources TARGET) FILES ${ARG_FILES}) set_target_properties(${TARGET} PROPERTIES CXX_SCAN_FOR_MODULES ON) target_compile_features(${TARGET} PUBLIC cxx_std_26) - # See streamr_add_module_library: BMI/importer -pthread consistency. + # See streamr_add_module_library: BMI/importer -pthread consistency + # and position independence for the shared-library link. target_compile_options(${TARGET} PUBLIC $<$:-pthread>) + set_target_properties(${TARGET} PROPERTIES POSITION_INDEPENDENT_CODE ON) endfunction() # streamr_enable_imports() diff --git a/packages/streamr-json/StreamrModules.cmake b/packages/streamr-json/StreamrModules.cmake index 2bb5f1e6..04160292 100644 --- a/packages/streamr-json/StreamrModules.cmake +++ b/packages/streamr-json/StreamrModules.cmake @@ -120,6 +120,13 @@ function(streamr_add_module_library TARGET) # undeclared). Making the flag part of the PUBLIC interface keeps the # BMI and every importer consistent. No-op on other platforms. target_compile_options(${TARGET} PUBLIC $<$:-pthread>) + # The module libraries' objects end up inside the shared + # libstreamrproxyclient, so they must be position-independent. macOS + # emits PIC by default; on Linux the ELF linker rejects the archive + # otherwise ("recompile with -fPIC" against the module vtable/thunk + # symbols — first seen when the consolidated code moved into module + # objects on the linux-arm64 leg). + set_target_properties(${TARGET} PROPERTIES POSITION_INDEPENDENT_CODE ON) endfunction() # streamr_target_module_sources( FILES ...) @@ -143,8 +150,10 @@ function(streamr_target_module_sources TARGET) FILES ${ARG_FILES}) set_target_properties(${TARGET} PROPERTIES CXX_SCAN_FOR_MODULES ON) target_compile_features(${TARGET} PUBLIC cxx_std_26) - # See streamr_add_module_library: BMI/importer -pthread consistency. + # See streamr_add_module_library: BMI/importer -pthread consistency + # and position independence for the shared-library link. target_compile_options(${TARGET} PUBLIC $<$:-pthread>) + set_target_properties(${TARGET} PROPERTIES POSITION_INDEPENDENT_CODE ON) endfunction() # streamr_enable_imports() diff --git a/packages/streamr-libstreamrproxyclient/StreamrModules.cmake b/packages/streamr-libstreamrproxyclient/StreamrModules.cmake index 2bb5f1e6..04160292 100644 --- a/packages/streamr-libstreamrproxyclient/StreamrModules.cmake +++ b/packages/streamr-libstreamrproxyclient/StreamrModules.cmake @@ -120,6 +120,13 @@ function(streamr_add_module_library TARGET) # undeclared). Making the flag part of the PUBLIC interface keeps the # BMI and every importer consistent. No-op on other platforms. target_compile_options(${TARGET} PUBLIC $<$:-pthread>) + # The module libraries' objects end up inside the shared + # libstreamrproxyclient, so they must be position-independent. macOS + # emits PIC by default; on Linux the ELF linker rejects the archive + # otherwise ("recompile with -fPIC" against the module vtable/thunk + # symbols — first seen when the consolidated code moved into module + # objects on the linux-arm64 leg). + set_target_properties(${TARGET} PROPERTIES POSITION_INDEPENDENT_CODE ON) endfunction() # streamr_target_module_sources( FILES ...) @@ -143,8 +150,10 @@ function(streamr_target_module_sources TARGET) FILES ${ARG_FILES}) set_target_properties(${TARGET} PROPERTIES CXX_SCAN_FOR_MODULES ON) target_compile_features(${TARGET} PUBLIC cxx_std_26) - # See streamr_add_module_library: BMI/importer -pthread consistency. + # See streamr_add_module_library: BMI/importer -pthread consistency + # and position independence for the shared-library link. target_compile_options(${TARGET} PUBLIC $<$:-pthread>) + set_target_properties(${TARGET} PROPERTIES POSITION_INDEPENDENT_CODE ON) endfunction() # streamr_enable_imports() diff --git a/packages/streamr-libstreamrproxyclient/lint.sh b/packages/streamr-libstreamrproxyclient/lint.sh index f26b6ea2..2c0d63a1 100755 --- a/packages/streamr-libstreamrproxyclient/lint.sh +++ b/packages/streamr-libstreamrproxyclient/lint.sh @@ -5,7 +5,16 @@ set -e FILES=$(find . -type d \( -name src -o -name include -o -name test \) ! -path '*/build/*' ! -path '*/android/*' ! -path '*/android-library-module/*' ! -path '*/ios/*' ! -path '*/proto/*' -print0 | xargs -0 -I{} find {} -type f \( -name "*.hpp" -o -name "*.cpp" \) -print0 | xargs -0 echo) echo "Running clangd-tidy on $FILES" -clangd-tidy -p ./build $FILES +# src/streamrproxyclient.cpp is excluded from clangd-tidy +# (owner-approved selective disabling, Phase 2.6 consolidation): the +# file imports module interfaces from four packages, and building that +# module graph inside a single clangd exhausts memory on the 2-core +# 7 GB CI runners even with -j 1 (clangd dies mid-protocol, +# "Invalid header end"). The compiler builds the file on every +# platform and clang-format still checks it; revisit when CI runners +# grow or clangd's module memory use shrinks. +TIDY_FILES=$(echo "$FILES" | tr ' ' '\n' | grep -v 'src/streamrproxyclient.cpp' | tr '\n' ' ') +clangd-tidy -j 1 -p ./build $TIDY_FILES echo "Running clang-format --dry-run on $FILES" ../../run-clang-format.py $FILES diff --git a/packages/streamr-libstreamrproxyclient/src/streamrproxyclient.cpp b/packages/streamr-libstreamrproxyclient/src/streamrproxyclient.cpp index f0b0f8c7..97f25b4e 100644 --- a/packages/streamr-libstreamrproxyclient/src/streamrproxyclient.cpp +++ b/packages/streamr-libstreamrproxyclient/src/streamrproxyclient.cpp @@ -21,9 +21,15 @@ #include #include -import streamr.dht; +import streamr.trackerlessnetwork.protos; +import streamr.dht.ConnectionManager; +import streamr.dht.Connectivity; +import streamr.dht.ConnectorFacade; +import streamr.dht.FakeTransport; +import streamr.dht.Identifiers; +import streamr.dht.protos; import streamr.logger; -import streamr.trackerlessnetwork; +import streamr.trackerlessnetwork.ProxyClient; import streamr.utils; namespace streamr::libstreamrproxyclient { diff --git a/packages/streamr-logger/StreamrModules.cmake b/packages/streamr-logger/StreamrModules.cmake index 2bb5f1e6..04160292 100644 --- a/packages/streamr-logger/StreamrModules.cmake +++ b/packages/streamr-logger/StreamrModules.cmake @@ -120,6 +120,13 @@ function(streamr_add_module_library TARGET) # undeclared). Making the flag part of the PUBLIC interface keeps the # BMI and every importer consistent. No-op on other platforms. target_compile_options(${TARGET} PUBLIC $<$:-pthread>) + # The module libraries' objects end up inside the shared + # libstreamrproxyclient, so they must be position-independent. macOS + # emits PIC by default; on Linux the ELF linker rejects the archive + # otherwise ("recompile with -fPIC" against the module vtable/thunk + # symbols — first seen when the consolidated code moved into module + # objects on the linux-arm64 leg). + set_target_properties(${TARGET} PROPERTIES POSITION_INDEPENDENT_CODE ON) endfunction() # streamr_target_module_sources( FILES ...) @@ -143,8 +150,10 @@ function(streamr_target_module_sources TARGET) FILES ${ARG_FILES}) set_target_properties(${TARGET} PROPERTIES CXX_SCAN_FOR_MODULES ON) target_compile_features(${TARGET} PUBLIC cxx_std_26) - # See streamr_add_module_library: BMI/importer -pthread consistency. + # See streamr_add_module_library: BMI/importer -pthread consistency + # and position independence for the shared-library link. target_compile_options(${TARGET} PUBLIC $<$:-pthread>) + set_target_properties(${TARGET} PROPERTIES POSITION_INDEPENDENT_CODE ON) endfunction() # streamr_enable_imports() diff --git a/packages/streamr-proto-rpc/StreamrModules.cmake b/packages/streamr-proto-rpc/StreamrModules.cmake index 2bb5f1e6..04160292 100644 --- a/packages/streamr-proto-rpc/StreamrModules.cmake +++ b/packages/streamr-proto-rpc/StreamrModules.cmake @@ -120,6 +120,13 @@ function(streamr_add_module_library TARGET) # undeclared). Making the flag part of the PUBLIC interface keeps the # BMI and every importer consistent. No-op on other platforms. target_compile_options(${TARGET} PUBLIC $<$:-pthread>) + # The module libraries' objects end up inside the shared + # libstreamrproxyclient, so they must be position-independent. macOS + # emits PIC by default; on Linux the ELF linker rejects the archive + # otherwise ("recompile with -fPIC" against the module vtable/thunk + # symbols — first seen when the consolidated code moved into module + # objects on the linux-arm64 leg). + set_target_properties(${TARGET} PROPERTIES POSITION_INDEPENDENT_CODE ON) endfunction() # streamr_target_module_sources( FILES ...) @@ -143,8 +150,10 @@ function(streamr_target_module_sources TARGET) FILES ${ARG_FILES}) set_target_properties(${TARGET} PROPERTIES CXX_SCAN_FOR_MODULES ON) target_compile_features(${TARGET} PUBLIC cxx_std_26) - # See streamr_add_module_library: BMI/importer -pthread consistency. + # See streamr_add_module_library: BMI/importer -pthread consistency + # and position independence for the shared-library link. target_compile_options(${TARGET} PUBLIC $<$:-pthread>) + set_target_properties(${TARGET} PROPERTIES POSITION_INDEPENDENT_CODE ON) endfunction() # streamr_enable_imports() diff --git a/packages/streamr-trackerless-network/StreamrModules.cmake b/packages/streamr-trackerless-network/StreamrModules.cmake index 2bb5f1e6..04160292 100644 --- a/packages/streamr-trackerless-network/StreamrModules.cmake +++ b/packages/streamr-trackerless-network/StreamrModules.cmake @@ -120,6 +120,13 @@ function(streamr_add_module_library TARGET) # undeclared). Making the flag part of the PUBLIC interface keeps the # BMI and every importer consistent. No-op on other platforms. target_compile_options(${TARGET} PUBLIC $<$:-pthread>) + # The module libraries' objects end up inside the shared + # libstreamrproxyclient, so they must be position-independent. macOS + # emits PIC by default; on Linux the ELF linker rejects the archive + # otherwise ("recompile with -fPIC" against the module vtable/thunk + # symbols — first seen when the consolidated code moved into module + # objects on the linux-arm64 leg). + set_target_properties(${TARGET} PROPERTIES POSITION_INDEPENDENT_CODE ON) endfunction() # streamr_target_module_sources( FILES ...) @@ -143,8 +150,10 @@ function(streamr_target_module_sources TARGET) FILES ${ARG_FILES}) set_target_properties(${TARGET} PROPERTIES CXX_SCAN_FOR_MODULES ON) target_compile_features(${TARGET} PUBLIC cxx_std_26) - # See streamr_add_module_library: BMI/importer -pthread consistency. + # See streamr_add_module_library: BMI/importer -pthread consistency + # and position independence for the shared-library link. target_compile_options(${TARGET} PUBLIC $<$:-pthread>) + set_target_properties(${TARGET} PROPERTIES POSITION_INDEPENDENT_CODE ON) endfunction() # streamr_enable_imports() diff --git a/packages/streamr-trackerless-network/modules/logic/ContentDeliveryRpcLocal.cppm b/packages/streamr-trackerless-network/modules/logic/ContentDeliveryRpcLocal.cppm index acb398b3..44e470bf 100644 --- a/packages/streamr-trackerless-network/modules/logic/ContentDeliveryRpcLocal.cppm +++ b/packages/streamr-trackerless-network/modules/logic/ContentDeliveryRpcLocal.cppm @@ -1,4 +1,4 @@ -// Module partition streamr.trackerlessnetwork:ContentDeliveryRpcLocal +// Module streamr.trackerlessnetwork.ContentDeliveryRpcLocal // CONSOLIDATED from the former header logic/ContentDeliveryRpcLocal.hpp // (MODERNIZATION.md Phase 2.6): this file is now the source of truth. module; @@ -7,9 +7,12 @@ module; #include "packages/network/protos/NetworkRpc.pb.h" #include "packages/network/protos/NetworkRpc.server.pb.h" -export module streamr.trackerlessnetwork:ContentDeliveryRpcLocal; +export module streamr.trackerlessnetwork.ContentDeliveryRpcLocal; -import streamr.dht; +import streamr.dht.DhtCallContext; +import streamr.dht.Identifiers; +import streamr.dht.ListeningRpcCommunicator; +import streamr.dht.protos; import streamr.utils; // Hoisted from the former header (file scope, NOT exported); diff --git a/packages/streamr-trackerless-network/modules/logic/ContentDeliveryRpcRemote.cppm b/packages/streamr-trackerless-network/modules/logic/ContentDeliveryRpcRemote.cppm index 9765b0bf..eb91c911 100644 --- a/packages/streamr-trackerless-network/modules/logic/ContentDeliveryRpcRemote.cppm +++ b/packages/streamr-trackerless-network/modules/logic/ContentDeliveryRpcRemote.cppm @@ -1,4 +1,4 @@ -// Module partition streamr.trackerlessnetwork:ContentDeliveryRpcRemote +// Module streamr.trackerlessnetwork.ContentDeliveryRpcRemote // CONSOLIDATED from the former header logic/ContentDeliveryRpcRemote.hpp // (MODERNIZATION.md Phase 2.6): this file is now the source of truth. module; @@ -9,9 +9,11 @@ module; #include "packages/network/protos/NetworkRpc.client.pb.h" #include "packages/network/protos/NetworkRpc.pb.h" -export module streamr.trackerlessnetwork:ContentDeliveryRpcRemote; +export module streamr.trackerlessnetwork.ContentDeliveryRpcRemote; -import streamr.dht; +import streamr.dht.DhtCallContext; +import streamr.dht.RpcRemote; +import streamr.dht.protos; import streamr.logger; import streamr.utils; diff --git a/packages/streamr-trackerless-network/modules/logic/DuplicateMessageDetector.cppm b/packages/streamr-trackerless-network/modules/logic/DuplicateMessageDetector.cppm index 104f7952..248ea443 100644 --- a/packages/streamr-trackerless-network/modules/logic/DuplicateMessageDetector.cppm +++ b/packages/streamr-trackerless-network/modules/logic/DuplicateMessageDetector.cppm @@ -1,4 +1,4 @@ -// Module partition streamr.trackerlessnetwork:DuplicateMessageDetector +// Module streamr.trackerlessnetwork.DuplicateMessageDetector // CONSOLIDATED from the former header logic/DuplicateMessageDetector.hpp // (MODERNIZATION.md Phase 2.6): this file is now the source of truth. module; @@ -9,7 +9,7 @@ module; #include #include -export module streamr.trackerlessnetwork:DuplicateMessageDetector; +export module streamr.trackerlessnetwork.DuplicateMessageDetector; import streamr.logger; diff --git a/packages/streamr-trackerless-network/modules/logic/NodeList.cppm b/packages/streamr-trackerless-network/modules/logic/NodeList.cppm index 6fde3a0a..df41186b 100644 --- a/packages/streamr-trackerless-network/modules/logic/NodeList.cppm +++ b/packages/streamr-trackerless-network/modules/logic/NodeList.cppm @@ -1,4 +1,4 @@ -// Module partition streamr.trackerlessnetwork:NodeList +// Module streamr.trackerlessnetwork.NodeList // CONSOLIDATED from the former header logic/NodeList.hpp // (MODERNIZATION.md Phase 2.6): this file is now the source of truth. module; @@ -7,11 +7,11 @@ module; #include #include -export module streamr.trackerlessnetwork:NodeList; +export module streamr.trackerlessnetwork.NodeList; -import streamr.dht; +import streamr.dht.Identifiers; import streamr.eventemitter; -import :ContentDeliveryRpcRemote; +import streamr.trackerlessnetwork.ContentDeliveryRpcRemote; // Hoisted from the former header (file scope, NOT exported); // fully qualified because relative namespace names resolve @@ -22,7 +22,10 @@ using streamr::eventemitter::Event; using streamr::eventemitter::EventEmitter; export namespace streamr::trackerlessnetwork { -class ContentDeliveryRpcRemote; +// NOTE: the former header forward-declared ContentDeliveryRpcRemote +// here; in the named-sub-module world a purview forward declaration +// would attach the name to THIS module and conflict with the defining +// module, so the import above provides the declaration instead. struct NodeAdded : Event> {}; struct NodeRemoved diff --git a/packages/streamr-trackerless-network/modules/logic/Utils.cppm b/packages/streamr-trackerless-network/modules/logic/Utils.cppm index e1c7d20f..77d56fea 100644 --- a/packages/streamr-trackerless-network/modules/logic/Utils.cppm +++ b/packages/streamr-trackerless-network/modules/logic/Utils.cppm @@ -1,4 +1,4 @@ -// Module partition streamr.trackerlessnetwork:Utils +// Module streamr.trackerlessnetwork.Utils // CONSOLIDATED from the former header logic/Utils.hpp // (MODERNIZATION.md Phase 2.6): this file is now the source of truth. module; @@ -9,10 +9,10 @@ module; #include #include "packages/network/protos/NetworkRpc.pb.h" -export module streamr.trackerlessnetwork:Utils; +export module streamr.trackerlessnetwork.Utils; -import streamr.dht; -import :DuplicateMessageDetector; +import streamr.dht.Identifiers; +import streamr.trackerlessnetwork.DuplicateMessageDetector; // Hoisted from the former header (file scope, NOT exported); // fully qualified because relative namespace names resolve diff --git a/packages/streamr-trackerless-network/modules/logic/formStreamPartDeliveryServiceId.cppm b/packages/streamr-trackerless-network/modules/logic/formStreamPartDeliveryServiceId.cppm index 15695b0e..4a5c2a4c 100644 --- a/packages/streamr-trackerless-network/modules/logic/formStreamPartDeliveryServiceId.cppm +++ b/packages/streamr-trackerless-network/modules/logic/formStreamPartDeliveryServiceId.cppm @@ -1,4 +1,4 @@ -// Module partition streamr.trackerlessnetwork:formStreamPartDeliveryServiceId +// Module streamr.trackerlessnetwork.formStreamPartDeliveryServiceId // CONSOLIDATED from the former header logic/formStreamPartDeliveryServiceId.hpp // (MODERNIZATION.md Phase 2.6): this file is now the source of truth. module; @@ -9,9 +9,9 @@ module; // transitively from the sibling headers it included.) #include -export module streamr.trackerlessnetwork:formStreamPartDeliveryServiceId; +export module streamr.trackerlessnetwork.formStreamPartDeliveryServiceId; -import streamr.dht; +import streamr.dht.Identifiers; import streamr.utils; // Hoisted from the former header (file scope, NOT exported); diff --git a/packages/streamr-trackerless-network/modules/logic/propagation/FifoMapWithTTL.cppm b/packages/streamr-trackerless-network/modules/logic/propagation/FifoMapWithTTL.cppm index 7ae0b53d..359adf6a 100644 --- a/packages/streamr-trackerless-network/modules/logic/propagation/FifoMapWithTTL.cppm +++ b/packages/streamr-trackerless-network/modules/logic/propagation/FifoMapWithTTL.cppm @@ -1,4 +1,4 @@ -// Module partition streamr.trackerlessnetwork:FifoMapWithTTL +// Module streamr.trackerlessnetwork.FifoMapWithTTL // CONSOLIDATED from the former header logic/propagation/FifoMapWithTTL.hpp // (MODERNIZATION.md Phase 2.6): this file is now the source of truth. module; @@ -11,15 +11,14 @@ module; #include #include "packages/network/protos/NetworkRpc.pb.h" -export module streamr.trackerlessnetwork:FifoMapWithTTL; +export module streamr.trackerlessnetwork.FifoMapWithTTL; -import :RandomAccessQueue; -inline bool operator<(const MessageRef& r1, const MessageRef& r2) { - if (r1.sequencenumber() != r2.sequencenumber()) { - return r1.sequencenumber() < r2.sequencenumber(); - } - return r1.timestamp() < r2.timestamp(); -} +import streamr.trackerlessnetwork.RandomAccessQueue; +// The MessageRef ordering operator moved to the +// streamr.trackerlessnetwork.protos module (exported there): as a +// non-exported file-scope function here it had module linkage and was +// unreachable from other modules instantiating the map templates. +import streamr.trackerlessnetwork.protos; export namespace streamr::trackerlessnetwork::propagation { diff --git a/packages/streamr-trackerless-network/modules/logic/propagation/Propagation.cppm b/packages/streamr-trackerless-network/modules/logic/propagation/Propagation.cppm index dd22ac2d..9977a6ce 100644 --- a/packages/streamr-trackerless-network/modules/logic/propagation/Propagation.cppm +++ b/packages/streamr-trackerless-network/modules/logic/propagation/Propagation.cppm @@ -1,4 +1,4 @@ -// Module partition streamr.trackerlessnetwork:Propagation +// Module streamr.trackerlessnetwork.Propagation // CONSOLIDATED from the former header logic/propagation/Propagation.hpp // (MODERNIZATION.md Phase 2.6): this file is now the source of truth. module; @@ -7,10 +7,11 @@ module; #include "packages/dht/protos/DhtRpc.pb.h" #include "packages/network/protos/NetworkRpc.pb.h" -export module streamr.trackerlessnetwork:Propagation; +export module streamr.trackerlessnetwork.Propagation; -import streamr.dht; -import :PropagationTaskStore; +import streamr.dht.Identifiers; +import streamr.dht.protos; +import streamr.trackerlessnetwork.PropagationTaskStore; // Hoisted from the former header (file scope, NOT exported); // fully qualified because relative namespace names resolve diff --git a/packages/streamr-trackerless-network/modules/logic/propagation/PropagationTaskStore.cppm b/packages/streamr-trackerless-network/modules/logic/propagation/PropagationTaskStore.cppm index 0d5ed431..f8c438ee 100644 --- a/packages/streamr-trackerless-network/modules/logic/propagation/PropagationTaskStore.cppm +++ b/packages/streamr-trackerless-network/modules/logic/propagation/PropagationTaskStore.cppm @@ -1,4 +1,4 @@ -// Module partition streamr.trackerlessnetwork:PropagationTaskStore +// Module streamr.trackerlessnetwork.PropagationTaskStore // CONSOLIDATED from the former header // logic/propagation/PropagationTaskStore.hpp (MODERNIZATION.md Phase 2.6): this // file is now the source of truth. @@ -10,10 +10,10 @@ module; #include #include "packages/network/protos/NetworkRpc.pb.h" -export module streamr.trackerlessnetwork:PropagationTaskStore; +export module streamr.trackerlessnetwork.PropagationTaskStore; -import streamr.dht; -import :FifoMapWithTTL; +import streamr.dht.Identifiers; +import streamr.trackerlessnetwork.FifoMapWithTTL; // Hoisted from the former header (file scope, NOT exported); // fully qualified because relative namespace names resolve diff --git a/packages/streamr-trackerless-network/modules/logic/propagation/RandomAccessQueue.cppm b/packages/streamr-trackerless-network/modules/logic/propagation/RandomAccessQueue.cppm index 60f6307f..6a81c36b 100644 --- a/packages/streamr-trackerless-network/modules/logic/propagation/RandomAccessQueue.cppm +++ b/packages/streamr-trackerless-network/modules/logic/propagation/RandomAccessQueue.cppm @@ -1,4 +1,4 @@ -// Module partition streamr.trackerlessnetwork:RandomAccessQueue +// Module streamr.trackerlessnetwork.RandomAccessQueue // CONSOLIDATED from the former header logic/propagation/RandomAccessQueue.hpp // (MODERNIZATION.md Phase 2.6): this file is now the source of truth. module; @@ -8,7 +8,7 @@ module; #include #include -export module streamr.trackerlessnetwork:RandomAccessQueue; +export module streamr.trackerlessnetwork.RandomAccessQueue; export namespace streamr::trackerlessnetwork::propagation { class QueueToken { diff --git a/packages/streamr-trackerless-network/modules/logic/proxy/ProxyClient.cppm b/packages/streamr-trackerless-network/modules/logic/proxy/ProxyClient.cppm index bbbc04fe..d21a0514 100644 --- a/packages/streamr-trackerless-network/modules/logic/proxy/ProxyClient.cppm +++ b/packages/streamr-trackerless-network/modules/logic/proxy/ProxyClient.cppm @@ -1,4 +1,4 @@ -// Module partition streamr.trackerlessnetwork:ProxyClient +// Module streamr.trackerlessnetwork.ProxyClient // CONSOLIDATED from the former header logic/proxy/ProxyClient.hpp // (MODERNIZATION.md Phase 2.6): this file is now the source of truth. module; @@ -16,21 +16,27 @@ module; #include "packages/dht/protos/DhtRpc.pb.h" #include "packages/network/protos/NetworkRpc.pb.h" -export module streamr.trackerlessnetwork:ProxyClient; +export module streamr.trackerlessnetwork.ProxyClient; -import streamr.dht; +import streamr.dht.DhtCallContext; +import streamr.dht.ListeningRpcCommunicator; +import streamr.dht.ConnectionLockStates; +import streamr.dht.ConnectionLocker; +import streamr.dht.Identifiers; +import streamr.dht.Transport; +import streamr.dht.protos; import streamr.eventemitter; import streamr.logger; import streamr.utils; -import :ContentDeliveryRpcLocal; -import :ContentDeliveryRpcRemote; -import :DuplicateMessageDetector; -import :NodeList; -import :Propagation; -import :ProxyConnectionRpcLocal; -import :ProxyConnectionRpcRemote; -import :Utils; -import :formStreamPartDeliveryServiceId; +import streamr.trackerlessnetwork.ContentDeliveryRpcLocal; +import streamr.trackerlessnetwork.ContentDeliveryRpcRemote; +import streamr.trackerlessnetwork.DuplicateMessageDetector; +import streamr.trackerlessnetwork.NodeList; +import streamr.trackerlessnetwork.Propagation; +import streamr.trackerlessnetwork.ProxyConnectionRpcLocal; +import streamr.trackerlessnetwork.ProxyConnectionRpcRemote; +import streamr.trackerlessnetwork.Utils; +import streamr.trackerlessnetwork.formStreamPartDeliveryServiceId; // Hoisted from the former header (file scope, NOT exported); // fully qualified because relative namespace names resolve @@ -38,6 +44,7 @@ import :formStreamPartDeliveryServiceId; using streamr::dht::DhtAddress; using streamr::dht::connection::ConnectionLocker; using streamr::dht::connection::LockID; +using streamr::dht::transport::ListeningRpcCommunicator; using streamr::dht::transport::Transport; using streamr::eventemitter::Event; using streamr::eventemitter::EventEmitter; @@ -46,6 +53,10 @@ using streamr::utils::AbortController; using streamr::utils::EthereumAddress; using streamr::utils::RetryUtils; using streamr::utils::StreamPartID; + +using streamr::dht::Identifiers; +using streamr::dht::rpcprotocol::DhtCallContext; + export namespace streamr::trackerlessnetwork::proxy { using ::dht::PeerDescriptor; diff --git a/packages/streamr-trackerless-network/modules/logic/proxy/ProxyConnectionRpcLocal.cppm b/packages/streamr-trackerless-network/modules/logic/proxy/ProxyConnectionRpcLocal.cppm index 93e2d404..7af40249 100644 --- a/packages/streamr-trackerless-network/modules/logic/proxy/ProxyConnectionRpcLocal.cppm +++ b/packages/streamr-trackerless-network/modules/logic/proxy/ProxyConnectionRpcLocal.cppm @@ -1,4 +1,4 @@ -// Module partition streamr.trackerlessnetwork:ProxyConnectionRpcLocal +// Module streamr.trackerlessnetwork.ProxyConnectionRpcLocal // CONSOLIDATED from the former header logic/proxy/ProxyConnectionRpcLocal.hpp // (MODERNIZATION.md Phase 2.6): this file is now the source of truth. module; @@ -8,12 +8,16 @@ module; #include "packages/network/protos/NetworkRpc.pb.h" #include "packages/network/protos/NetworkRpc.server.pb.h" -export module streamr.trackerlessnetwork:ProxyConnectionRpcLocal; +export module streamr.trackerlessnetwork.ProxyConnectionRpcLocal; -import streamr.dht; +import streamr.logger; +import streamr.dht.DhtCallContext; +import streamr.dht.Identifiers; +import streamr.dht.ListeningRpcCommunicator; +import streamr.dht.protos; import streamr.eventemitter; import streamr.utils; -import :ContentDeliveryRpcRemote; +import streamr.trackerlessnetwork.ContentDeliveryRpcRemote; // Hoisted from the former header (file scope, NOT exported); // fully qualified because relative namespace names resolve @@ -24,10 +28,12 @@ using streamr::dht::rpcprotocol::DhtCallContext; using streamr::dht::transport::ListeningRpcCommunicator; using streamr::eventemitter::Event; using streamr::eventemitter::EventEmitter; +using streamr::logger::SLogger; using streamr::utils::BinaryUtils; using streamr::utils::EthereumAddress; using streamr::utils::StreamPartID; using streamr::utils::toEthereumAddress; + export namespace streamr::trackerlessnetwork::proxy { using ::dht::PeerDescriptor; diff --git a/packages/streamr-trackerless-network/modules/logic/proxy/ProxyConnectionRpcRemote.cppm b/packages/streamr-trackerless-network/modules/logic/proxy/ProxyConnectionRpcRemote.cppm index cc1d7c6a..b7ae3af3 100644 --- a/packages/streamr-trackerless-network/modules/logic/proxy/ProxyConnectionRpcRemote.cppm +++ b/packages/streamr-trackerless-network/modules/logic/proxy/ProxyConnectionRpcRemote.cppm @@ -1,4 +1,4 @@ -// Module partition streamr.trackerlessnetwork:ProxyConnectionRpcRemote +// Module streamr.trackerlessnetwork.ProxyConnectionRpcRemote // CONSOLIDATED from the former header logic/proxy/ProxyConnectionRpcRemote.hpp // (MODERNIZATION.md Phase 2.6): this file is now the source of truth. module; @@ -8,9 +8,11 @@ module; #include "packages/network/protos/NetworkRpc.client.pb.h" #include "packages/network/protos/NetworkRpc.pb.h" -export module streamr.trackerlessnetwork:ProxyConnectionRpcRemote; +export module streamr.trackerlessnetwork.ProxyConnectionRpcRemote; -import streamr.dht; +import streamr.dht.DhtCallContext; +import streamr.dht.RpcRemote; +import streamr.dht.protos; import streamr.logger; import streamr.utils; diff --git a/packages/streamr-trackerless-network/modules/streamr.trackerlessnetwork-protos.cppm b/packages/streamr-trackerless-network/modules/streamr.trackerlessnetwork-protos.cppm index 87132596..45e48e70 100644 --- a/packages/streamr-trackerless-network/modules/streamr.trackerlessnetwork-protos.cppm +++ b/packages/streamr-trackerless-network/modules/streamr.trackerlessnetwork-protos.cppm @@ -8,7 +8,7 @@ module; #include "packages/network/protos/NetworkRpc.pb.h" #include "packages/network/protos/NetworkRpc.server.pb.h" -export module streamr.trackerlessnetwork:protos; +export module streamr.trackerlessnetwork.protos; // messages export using ::CloseTemporaryConnection; @@ -58,3 +58,15 @@ using streamr::protorpc::TemporaryConnectionRpc; using streamr::protorpc::TemporaryConnectionRpcClient; } // namespace streamr::protorpc + +// Ordering for MessageRef (used as an ordered-container key across the +// package). Exported here, next to the type's re-export, so every +// importer of the protos module can order MessageRef values; the +// operator lives in the global namespace like the generated type +// itself, so argument-dependent lookup finds it. +export inline bool operator<(const MessageRef& r1, const MessageRef& r2) { + if (r1.sequencenumber() != r2.sequencenumber()) { + return r1.sequencenumber() < r2.sequencenumber(); + } + return r1.timestamp() < r2.timestamp(); +} diff --git a/packages/streamr-trackerless-network/modules/streamr.trackerlessnetwork.cppm b/packages/streamr-trackerless-network/modules/streamr.trackerlessnetwork.cppm deleted file mode 100644 index 8d06b5b7..00000000 --- a/packages/streamr-trackerless-network/modules/streamr.trackerlessnetwork.cppm +++ /dev/null @@ -1,17 +0,0 @@ -// Primary module interface unit of streamr.trackerlessnetwork. -export module streamr.trackerlessnetwork; - -export import :protos; -export import :ContentDeliveryRpcLocal; -export import :ContentDeliveryRpcRemote; -export import :DuplicateMessageDetector; -export import :FifoMapWithTTL; -export import :NodeList; -export import :Propagation; -export import :PropagationTaskStore; -export import :ProxyClient; -export import :ProxyConnectionRpcLocal; -export import :ProxyConnectionRpcRemote; -export import :RandomAccessQueue; -export import :Utils; -export import :formStreamPartDeliveryServiceId; diff --git a/packages/streamr-trackerless-network/test/integration/ProxyClientTsIntegrationTest.cpp b/packages/streamr-trackerless-network/test/integration/ProxyClientTsIntegrationTest.cpp index d20a14ad..12eac51d 100644 --- a/packages/streamr-trackerless-network/test/integration/ProxyClientTsIntegrationTest.cpp +++ b/packages/streamr-trackerless-network/test/integration/ProxyClientTsIntegrationTest.cpp @@ -2,9 +2,13 @@ #include "packages/dht/protos/DhtRpc.pb.h" #include "packages/network/protos/NetworkRpc.pb.h" -import streamr.dht; +import streamr.dht.ConnectionManager; +import streamr.dht.ConnectorFacade; +import streamr.dht.FakeTransport; +import streamr.dht.protos; import streamr.logger; -import streamr.trackerlessnetwork; +import streamr.trackerlessnetwork.ProxyClient; +import streamr.trackerlessnetwork.protos; import streamr.utils; using ::dht::ConnectivityMethod; diff --git a/packages/streamr-trackerless-network/test/unit/ContentDeliveryRpcLocalTest.cpp b/packages/streamr-trackerless-network/test/unit/ContentDeliveryRpcLocalTest.cpp index d29e32d2..32540141 100644 --- a/packages/streamr-trackerless-network/test/unit/ContentDeliveryRpcLocalTest.cpp +++ b/packages/streamr-trackerless-network/test/unit/ContentDeliveryRpcLocalTest.cpp @@ -1,6 +1,6 @@ #include -import streamr.trackerlessnetwork; +import streamr.trackerlessnetwork.ContentDeliveryRpcLocal; using streamr::trackerlessnetwork::ContentDeliveryRpcLocal; // NOLINT diff --git a/packages/streamr-trackerless-network/test/unit/ContentDeliveryRpcRemoteTest.cpp b/packages/streamr-trackerless-network/test/unit/ContentDeliveryRpcRemoteTest.cpp index 2f851d2b..fc697172 100644 --- a/packages/streamr-trackerless-network/test/unit/ContentDeliveryRpcRemoteTest.cpp +++ b/packages/streamr-trackerless-network/test/unit/ContentDeliveryRpcRemoteTest.cpp @@ -1,6 +1,6 @@ #include -import streamr.trackerlessnetwork; +import streamr.trackerlessnetwork.ContentDeliveryRpcRemote; using streamr::trackerlessnetwork::ContentDeliveryRpcRemote; // NOLINT diff --git a/packages/streamr-trackerless-network/test/unit/DuplicateMessageDetectorTest.cpp b/packages/streamr-trackerless-network/test/unit/DuplicateMessageDetectorTest.cpp index 8478fa05..ce5b9724 100644 --- a/packages/streamr-trackerless-network/test/unit/DuplicateMessageDetectorTest.cpp +++ b/packages/streamr-trackerless-network/test/unit/DuplicateMessageDetectorTest.cpp @@ -1,6 +1,6 @@ #include -import streamr.trackerlessnetwork; +import streamr.trackerlessnetwork.DuplicateMessageDetector; using streamr::trackerlessnetwork::DuplicateMessageDetector; // NOLINT diff --git a/packages/streamr-trackerless-network/test/unit/FifoMapWithTTLTest.cpp b/packages/streamr-trackerless-network/test/unit/FifoMapWithTTLTest.cpp index 8d33c1a4..069f0267 100644 --- a/packages/streamr-trackerless-network/test/unit/FifoMapWithTTLTest.cpp +++ b/packages/streamr-trackerless-network/test/unit/FifoMapWithTTLTest.cpp @@ -1,6 +1,6 @@ #include -import streamr.trackerlessnetwork; +import streamr.trackerlessnetwork.FifoMapWithTTL; using streamr::trackerlessnetwork::propagation::FifoMapWithTTL; // NOLINT diff --git a/packages/streamr-trackerless-network/test/unit/NodeListTest.cpp b/packages/streamr-trackerless-network/test/unit/NodeListTest.cpp index 3e7f872a..c9c19838 100644 --- a/packages/streamr-trackerless-network/test/unit/NodeListTest.cpp +++ b/packages/streamr-trackerless-network/test/unit/NodeListTest.cpp @@ -1,6 +1,6 @@ #include -import streamr.trackerlessnetwork; +import streamr.trackerlessnetwork.NodeList; using streamr::trackerlessnetwork::NodeList; // NOLINT diff --git a/packages/streamr-trackerless-network/test/unit/PropagationTaskStoreTest.cpp b/packages/streamr-trackerless-network/test/unit/PropagationTaskStoreTest.cpp index a4dbed1e..4a52fdb4 100644 --- a/packages/streamr-trackerless-network/test/unit/PropagationTaskStoreTest.cpp +++ b/packages/streamr-trackerless-network/test/unit/PropagationTaskStoreTest.cpp @@ -1,6 +1,6 @@ #include -import streamr.trackerlessnetwork; +import streamr.trackerlessnetwork.PropagationTaskStore; using streamr::trackerlessnetwork::propagation::PropagationTaskStore; // NOLINT diff --git a/packages/streamr-trackerless-network/test/unit/PropagationTest.cpp b/packages/streamr-trackerless-network/test/unit/PropagationTest.cpp index b6eb6251..830d564f 100644 --- a/packages/streamr-trackerless-network/test/unit/PropagationTest.cpp +++ b/packages/streamr-trackerless-network/test/unit/PropagationTest.cpp @@ -1,6 +1,6 @@ #include -import streamr.trackerlessnetwork; +import streamr.trackerlessnetwork.Propagation; using streamr::trackerlessnetwork::propagation::Propagation; // NOLINT diff --git a/packages/streamr-trackerless-network/test/unit/ProxyClientTest.cpp b/packages/streamr-trackerless-network/test/unit/ProxyClientTest.cpp index be92523b..072f5ad1 100644 --- a/packages/streamr-trackerless-network/test/unit/ProxyClientTest.cpp +++ b/packages/streamr-trackerless-network/test/unit/ProxyClientTest.cpp @@ -1,6 +1,6 @@ #include -import streamr.trackerlessnetwork; +import streamr.trackerlessnetwork.ProxyClient; using streamr::trackerlessnetwork::proxy::ProxyClient; // NOLINT diff --git a/packages/streamr-trackerless-network/test/unit/ProxyConnectionRpcLocalTest.cpp b/packages/streamr-trackerless-network/test/unit/ProxyConnectionRpcLocalTest.cpp index 8bf7f6a8..381a457c 100644 --- a/packages/streamr-trackerless-network/test/unit/ProxyConnectionRpcLocalTest.cpp +++ b/packages/streamr-trackerless-network/test/unit/ProxyConnectionRpcLocalTest.cpp @@ -1,6 +1,6 @@ #include -import streamr.trackerlessnetwork; +import streamr.trackerlessnetwork.ProxyConnectionRpcLocal; using streamr::trackerlessnetwork::proxy::ProxyConnectionRpcLocal; // NOLINT diff --git a/packages/streamr-trackerless-network/test/unit/ProxyConnectionRpcRemoteTest.cpp b/packages/streamr-trackerless-network/test/unit/ProxyConnectionRpcRemoteTest.cpp index 3e4a3cfb..e1a5366f 100644 --- a/packages/streamr-trackerless-network/test/unit/ProxyConnectionRpcRemoteTest.cpp +++ b/packages/streamr-trackerless-network/test/unit/ProxyConnectionRpcRemoteTest.cpp @@ -1,6 +1,6 @@ #include -import streamr.trackerlessnetwork; +import streamr.trackerlessnetwork.ProxyConnectionRpcRemote; using streamr::trackerlessnetwork::proxy::ProxyConnectionRpcRemote; // NOLINT diff --git a/packages/streamr-trackerless-network/test/unit/UtilsTest.cpp b/packages/streamr-trackerless-network/test/unit/UtilsTest.cpp index c59e47ac..e094b5b7 100644 --- a/packages/streamr-trackerless-network/test/unit/UtilsTest.cpp +++ b/packages/streamr-trackerless-network/test/unit/UtilsTest.cpp @@ -1,6 +1,6 @@ #include -import streamr.trackerlessnetwork; +import streamr.trackerlessnetwork.Utils; using streamr::trackerlessnetwork::Utils; // NOLINT diff --git a/packages/streamr-trackerless-network/test/unit/formStreamPartDeliveryServiceIdTest.cpp b/packages/streamr-trackerless-network/test/unit/formStreamPartDeliveryServiceIdTest.cpp index 7f9a562e..a1d279f8 100644 --- a/packages/streamr-trackerless-network/test/unit/formStreamPartDeliveryServiceIdTest.cpp +++ b/packages/streamr-trackerless-network/test/unit/formStreamPartDeliveryServiceIdTest.cpp @@ -1,6 +1,6 @@ #include -import streamr.trackerlessnetwork; +import streamr.trackerlessnetwork.formStreamPartDeliveryServiceId; using streamr::trackerlessnetwork:: formStreamPartContentDeliveryServiceId; // NOLINT diff --git a/packages/streamr-utils/StreamrModules.cmake b/packages/streamr-utils/StreamrModules.cmake index 2bb5f1e6..04160292 100644 --- a/packages/streamr-utils/StreamrModules.cmake +++ b/packages/streamr-utils/StreamrModules.cmake @@ -120,6 +120,13 @@ function(streamr_add_module_library TARGET) # undeclared). Making the flag part of the PUBLIC interface keeps the # BMI and every importer consistent. No-op on other platforms. target_compile_options(${TARGET} PUBLIC $<$:-pthread>) + # The module libraries' objects end up inside the shared + # libstreamrproxyclient, so they must be position-independent. macOS + # emits PIC by default; on Linux the ELF linker rejects the archive + # otherwise ("recompile with -fPIC" against the module vtable/thunk + # symbols — first seen when the consolidated code moved into module + # objects on the linux-arm64 leg). + set_target_properties(${TARGET} PROPERTIES POSITION_INDEPENDENT_CODE ON) endfunction() # streamr_target_module_sources( FILES ...) @@ -143,8 +150,10 @@ function(streamr_target_module_sources TARGET) FILES ${ARG_FILES}) set_target_properties(${TARGET} PROPERTIES CXX_SCAN_FOR_MODULES ON) target_compile_features(${TARGET} PUBLIC cxx_std_26) - # See streamr_add_module_library: BMI/importer -pthread consistency. + # See streamr_add_module_library: BMI/importer -pthread consistency + # and position independence for the shared-library link. target_compile_options(${TARGET} PUBLIC $<$:-pthread>) + set_target_properties(${TARGET} PROPERTIES POSITION_INDEPENDENT_CODE ON) endfunction() # streamr_enable_imports()