Decompose Core: split RPC/event setup into files + dedupe init guards
Move Core::setupRpcHandlers (→ CoreRpcHandlers.cpp) and Core::setupEventBusSubscriptions (→ CoreEventRelay.cpp) out of the 2100-line Core.cpp (now ~1535). They stay Core member functions — definitions live in dedicated translation units — which gives the file-decomposition without a risky 500-line this→core rewrite into separate classes. The RpcAuthRequest struct moves to RpcDtos.hpp as Dto::AuthRequest; the toJson<T> helper also moves there so both units share it. Add Core::requireInitialized() and collapse the 28 identical `if (!initialized_) return fail(ServiceUnavailable,…)` guards into `if (auto r = requireInitialized(); !r) return std::unexpected(r.error());`. Build green. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
0779fdcf20
commit
30884ad0b5
5 files changed
+604
-585
No files matched your search
@@ -162,6 +162,9 @@ namespace Echoion::Core
|
||||
// the global Void::Log sink (logSink_ must outlive logging).
|
||||
void installLogging();
|
||||
|
||||
// Guard helper: ok if initialized, else a ServiceUnavailable error.
|
||||
[[nodiscard]] Api::Result<void> requireInitialized() const noexcept;
|
||||
|
||||
// Components
|
||||
std::shared_ptr<NetworkClient> networkClient_;
|
||||
std::shared_ptr<MusicManager> musicManager_;
|
||||
|
||||
Reference in new issue
Block a user