mirror of
https://github.com/logos-co/logos-protocol.git
synced 2026-08-27 12:01:15 +00:00
* Extract the Logos protocol layer from logos-cpp-sdk
Transports (plain TCP/TLS, qt_local, qt_remote/QRO, mock), token manager,
consumer core (LogosAPIClient/LogosAPIConsumer incl. the capability
auto-requestModule flow), ModuleProxy, the abstract LogosProviderObject
interface, and the canonical QVariant<->JSON conversion — now behind the
language-neutral lp_* C ABI (logos_protocol.h) carrying the protocol
semver (LOGOS_PROTOCOL_VERSION_*, lp_protocol_version()).
Bytes crossing the ABI use the lossless {"_bytes": base64url} tagging
(NUL-safe), matching the plain wire encoding.
Provider lp_* surface is compiled groundwork; serving lands with module
authoring.
* consumer: typed requestModule for the capability flow
Port of logos-cpp-sdk master f5a127dd ('use updated capability module',
cpp-sdk#85, Iuri Matias) — the touched files (logos_api_client.cpp,
logos_api_consumer.{h,cpp}) moved into this repo in the P1 extraction.
The capability auto-requestModule path now calls a typed std::string
helper on the consumer (which acquires the capability object directly)
instead of a stringly invokeRemoteMethod round-trip. 111/111 tests.
33 lines
1.0 KiB
C++
33 lines
1.0 KiB
C++
#ifndef LOGOS_INSTANCE_H
|
|
#define LOGOS_INSTANCE_H
|
|
|
|
#include <QDebug>
|
|
#include <QString>
|
|
#include <QUuid>
|
|
|
|
/**
|
|
* @brief LogosInstance provides a shared identifier for all processes launched
|
|
* by Logos core
|
|
*
|
|
* The root process generates a UUID-based ID and exports it via the
|
|
* LOGOS_INSTANCE_ID environment variable. Child processes inherit the variable
|
|
* and return the same ID, so all processes in the application tree share one
|
|
* ID. Used by both provider and consumer to build matching registry URLs.
|
|
*/
|
|
namespace LogosInstance {
|
|
inline const QString id() {
|
|
const QByteArray inherited = qgetenv("LOGOS_INSTANCE_ID");
|
|
if (!inherited.isEmpty())
|
|
return QString::fromUtf8(inherited);
|
|
const QString newId = QUuid::createUuid().toString(QUuid::Id128).left(12);
|
|
qputenv("LOGOS_INSTANCE_ID", newId.toUtf8());
|
|
return newId;
|
|
}
|
|
|
|
inline QString id(const QString& moduleName) {
|
|
return QString("local:logos_%1_%2").arg(moduleName).arg(id());
|
|
}
|
|
}
|
|
|
|
#endif // LOGOS_INSTANCE_H
|