Draft
Conversation
Member
iurimatias
commented
Mar 17, 2026
- abstract qt remote registry
- abstract connection/transport; and clearly separate qt remote obj and qt local into separate implementations
…te obj and qt local into separate implementations
There was a problem hiding this comment.
Pull request overview
This PR introduces a transport abstraction layer to unify Local (in-process) and Remote (Qt Remote Objects) module communication, and refactors the provider/consumer APIs to use this abstraction instead of directly depending on PluginRegistry / QRemoteObjects.
Changes:
- Added
LogosTransport*interfaces plus factories and Qt-based local/remote implementations. - Added a minimal
LogosRegistryinterface with a factory (NullRegistry for local, QtRemoteRegistry for remote). - Updated build/packaging (CMake + Nix include install) to ship the new transport/registry sources and headers.
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| nix/include.nix | Installs new transport/registry headers/sources and implementation folders into the Nix include output. |
| cpp/logos_transport.h | Defines transport host/connection interfaces for publishing, connecting, requesting handles, and invoking methods. |
| cpp/logos_transport_factory.h | Declares factory functions for selecting local vs remote transport. |
| cpp/logos_transport_factory.cpp | Implements mode-based factory selection for transport host/connection. |
| cpp/logos_registry.h | Defines minimal registry interface for “registry is initialized” checks. |
| cpp/logos_registry_factory.h | Declares mode-based registry creation API. |
| cpp/logos_registry_factory.cpp | Implements NullRegistry (local) vs QtRemoteRegistry (remote) creation. |
| cpp/logos_api_provider.h | Replaces direct registry host usage with a transport-host abstraction. |
| cpp/logos_api_provider.cpp | Publishes/unpublishes module proxies via transport instead of PluginRegistry/QRemoteObjectRegistryHost directly. |
| cpp/logos_api_consumer.h | Replaces direct node usage with a transport-connection abstraction. |
| cpp/logos_api_consumer.cpp | Requests handles and performs calls through the transport layer; removes direct QRemoteObjectNode logic. |
| cpp/implementations/qt_local/local_transport.h | Declares local transport host/connection (PluginRegistry-based). |
| cpp/implementations/qt_local/local_transport.cpp | Implements local transport via PluginRegistry and ModuleProxy. |
| cpp/implementations/qt_remote/remote_transport.h | Declares remote transport host/connection (Qt Remote Objects-based). |
| cpp/implementations/qt_remote/remote_transport.cpp | Implements remote transport via QRemoteObjectRegistryHost/QRemoteObjectNode and pending calls. |
| cpp/implementations/qt_remote/qt_remote_registry.h | Declares a registry wrapper backed by QRemoteObjectRegistryHost. |
| cpp/implementations/qt_remote/qt_remote_registry.cpp | Implements QtRemoteRegistry lifecycle and initialization check. |
| cpp/CMakeLists.txt | Adds new sources/headers and include dirs; installs implementation headers; links RemoteObjects. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Comment on lines
+12
to
+22
| return std::make_unique<LocalTransportHost>(); | ||
| } | ||
| return std::make_unique<RemoteTransportHost>(registryUrl); | ||
| } | ||
|
|
||
| std::unique_ptr<LogosTransportConnection> createConnection(const QString& registryUrl) | ||
| { | ||
| if (LogosModeConfig::isLocal()) { | ||
| return std::make_unique<LocalTransportConnection>(); | ||
| } | ||
| return std::make_unique<RemoteTransportConnection>(registryUrl); |
Comment on lines
+26
to
+28
| return std::make_unique<NullRegistry>(); | ||
| } | ||
| return std::make_unique<QtRemoteRegistry>(url); |
cpp/logos_api_consumer.h
Outdated
Comment on lines
+48
to
+50
| * @param objectName The name of the object to acquire | ||
| * @param timeout Timeout to wait for the object to be ready (default 20000ms) | ||
| * @return QObject* pointer to the object, or nullptr if failed |
Comment on lines
69
to
+82
| QVariant LogosAPIConsumer::invokeRemoteMethod(const QString& authToken, const QString& objectName, const QString& methodName, | ||
| const QVariantList& args, Timeout timeout) | ||
| { | ||
| qDebug() << "LogosAPIConsumer: Calling invokeRemoteMethod:" << objectName << methodName << "args_count:" << args.size() << "timeout:" << timeout.ms; | ||
|
|
||
| // This method handles both ModuleProxy-wrapped modules (template_module, package_manager) | ||
| // and direct remote object calls for other modules | ||
| QObject* plugin = requestObject(objectName, timeout); | ||
| QObject* plugin = m_transport->requestObject(objectName, timeout.ms); | ||
| if (!plugin) { | ||
| qWarning() << "LogosAPIConsumer: Failed to acquire plugin/replica for object:" << objectName; | ||
| return QVariant(); | ||
| } | ||
|
|
||
| ModuleProxy* moduleProxy = qobject_cast<ModuleProxy*>(plugin); | ||
| if (moduleProxy) { | ||
| QVariant result = moduleProxy->callRemoteMethod(authToken, methodName, args); | ||
| if (!LogosModeConfig::isLocal()) { | ||
| delete plugin; | ||
| } | ||
| return result; | ||
| } | ||
|
|
||
| if (LogosModeConfig::isLocal()) { | ||
| qWarning() << "LogosAPIConsumer: Local mode requires ModuleProxy-wrapped objects"; | ||
| return QVariant(); | ||
| } | ||
|
|
||
| // Remote mode: callRemoteMethod returns QRemoteObjectPendingCall, not QVariant | ||
| QRemoteObjectPendingCall pendingCall; | ||
| bool success = QMetaObject::invokeMethod( | ||
| plugin, | ||
| "callRemoteMethod", | ||
| Qt::DirectConnection, | ||
| Q_RETURN_ARG(QRemoteObjectPendingCall, pendingCall), | ||
| Q_ARG(QString, authToken), | ||
| Q_ARG(QString, methodName), | ||
| Q_ARG(QVariantList, args) | ||
| ); | ||
|
|
||
| if (!success) { | ||
| qWarning() << "LogosAPIConsumer: Failed to invoke callRemoteMethod on replica for object:" << objectName; | ||
| delete plugin; | ||
| return QVariant(); | ||
| } | ||
|
|
||
| // Wait for the result | ||
| pendingCall.waitForFinished(timeout.ms); | ||
| delete plugin; | ||
|
|
||
| if (!pendingCall.isFinished() || pendingCall.error() != QRemoteObjectPendingCall::NoError) { | ||
| qWarning() << "LogosAPIConsumer: Remote callRemoteMethod failed or timed out:" << pendingCall.error(); | ||
| return QVariant(); | ||
| } | ||
|
|
||
| return pendingCall.returnValue(); | ||
| QVariant result = m_transport->callRemoteMethod(plugin, authToken, methodName, args, timeout.ms); | ||
| m_transport->releaseObject(plugin); | ||
| return result; |
| connectToRegistry(); | ||
| } | ||
| m_transport = LogosTransportFactory::createConnection(m_registryUrl); | ||
| m_transport->connectToHost(); |
… but also useful for testing modules later
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.