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.
45 lines
1.4 KiB
C++
45 lines
1.4 KiB
C++
#ifndef LOGOS_PLAIN_IO_CONTEXT_POOL_H
|
|
#define LOGOS_PLAIN_IO_CONTEXT_POOL_H
|
|
|
|
#include <boost/asio/executor_work_guard.hpp>
|
|
#include <boost/asio/io_context.hpp>
|
|
|
|
#include <memory>
|
|
#include <thread>
|
|
|
|
namespace logos::plain {
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// IoContextPool — owns a single boost::asio::io_context and a worker thread
|
|
// that runs it until the pool is destroyed.
|
|
//
|
|
// One pool per SDK process is sufficient for our traffic (a handful of
|
|
// concurrent connections). If we ever need more parallelism, swap for a
|
|
// multi-thread pool (one io_context per thread + round-robin dispatch).
|
|
//
|
|
// Access the shared pool via `sharedPool()`; tests / special cases can
|
|
// construct their own.
|
|
// -----------------------------------------------------------------------------
|
|
class IoContextPool {
|
|
public:
|
|
IoContextPool();
|
|
~IoContextPool();
|
|
|
|
IoContextPool(const IoContextPool&) = delete;
|
|
IoContextPool& operator=(const IoContextPool&) = delete;
|
|
|
|
boost::asio::io_context& ioContext() { return m_ioc; }
|
|
|
|
// Process-wide default pool. Thread-safe lazy init.
|
|
static IoContextPool& shared();
|
|
|
|
private:
|
|
boost::asio::io_context m_ioc;
|
|
boost::asio::executor_work_guard<boost::asio::io_context::executor_type> m_guard;
|
|
std::thread m_worker;
|
|
};
|
|
|
|
} // namespace logos::plain
|
|
|
|
#endif // LOGOS_PLAIN_IO_CONTEXT_POOL_H
|