feat: use logos-rust-sdk#25
Conversation
c439579 to
84874ea
Compare
| //! Logos modules normally push notifications to subscribers by emitting | ||
| //! plugin events through the SDK — the same mechanism we consume on the | ||
| //! receive side via `LogosModuleSDK::on(...)` (e.g. delivery_module's | ||
| //! `messageReceived`). The c-ffi module track has no story yet for | ||
| //! module-emitted events (logos-cpp-generator has no event-declaration | ||
| //! convention, the generated Qt glue has no emit forwarding, and | ||
| //! logos-rust-sdk has no Rust-side emit API), so we buffer events here | ||
| //! and consumers drain them via `chat_module_drain_events_json()`. |
There was a problem hiding this comment.
@iurimatias would it be possible to expose plugin->emitEvent to logos-rust-sdk?
| // boundaries. inbound.rs decodes on the receive side. | ||
| // | ||
| // TODO: drop once delivery_module exposes binary send / messageReceived | ||
| // (QByteArray) and logos-rust-sdk / logos-cpp-sdk add a bytes Param type. |
There was a problem hiding this comment.
@iurimatias just raising awareness, as of now binary blobs must be translated to a string-safe wrapper to fit the json envelope. Possible solution would be to replace json params with a binary format that has a native byte-string type (like cbor):
char* logos_sdk_call_method_sync(
const char* plugin_name,
const char* method_name,
- const char* params_json
+ const uint8_t* params_cbor,
+ size_t params_len
);wdyt?
84874ea to
736c266
Compare
Re-implement chat_module in Rust as a c-ffi module wrapping libchat via logos-rust-sdk, replacing the C++ Qt plugin around liblogoschat. - metadata.json: switch interface from universal to c-ffi; depend on delivery_module at runtime instead of bundling a chat library. - Generate include/chat_module.h from src/lib.rs with cbindgen at build. - Resolve Cargo git deps reproducibly via flake outputHashes (no vendored source tree). - Drop C++ sources, gtest harness, and liblogoschat stubs.
736c266 to
9992d59
Compare
igor-sirotin
left a comment
There was a problem hiding this comment.
Noice!
(I didn't quite check the Rust code, only high-level)
| @@ -0,0 +1,37 @@ | |||
| [package] | |||
| name = "chat_module" | |||
| version = "1.0.0" | |||
There was a problem hiding this comment.
| version = "1.0.0" | |
| version = "0.1.0" |
| "codegen": { | ||
| "impl_header": "chat_module_plugin.h" | ||
| "name": "chat_module", | ||
| "version": "1.0.0", |
There was a problem hiding this comment.
| "version": "1.0.0", | |
| "version": "0.1.0", |
| "name": "chat_module", | ||
| "version": "1.0.0", | ||
| "description": "Chat module for Logos", | ||
| "author": "Logos Core Team", |
There was a problem hiding this comment.
| "author": "Logos Core Team", | |
| "author": "Logos Team", |
| @@ -1,14 +1,5 @@ | |||
| .DS_Store | |||
There was a problem hiding this comment.
Please keep .DS_Store, it's classic MacOS thing
There was a problem hiding this comment.
The new CMake file looks quite complex, would be nice to find ways to simplify it in the future.
| /// | ||
| /// - `instance_path` – writable directory owned by this module instance | ||
| /// - `delivery_preset` – e.g. "logos.dev" (defaults to "logos.dev" if NULL) | ||
| /// - `tcp_port` – TCP port for the embedded Waku node (e.g. 60000) |
There was a problem hiding this comment.
TCP port shouldn't be exposed to client. Instead, a random port should be chosen automatically by logos-delivery-module. This is not yet the case, but we will will make it work — logos-co/logos-delivery-module#18 (comment).
At the moment the suggested workaround is to set portsShift
Re-implement chat_module in Rust as a c-ffi module wrapping libchat via
logos-rust-sdk, replacing the C++ Qt plugin around liblogoschat.
delivery_module at runtime instead of bundling a chat library.
vendored source tree).