Componentize logos delivery#148
Conversation
| crossbeam-channel = { workspace = true } | ||
| logos-chat = { workspace = true } | ||
|
|
||
|
|
| use components::{EmbeddedP2pDeliveryService, P2pConfig}; | ||
|
|
||
| #[derive(Debug)] | ||
| struct P2pTransport(EmbeddedP2pDeliveryService); |
There was a problem hiding this comment.
[question] why wrap the EmbeddedP2pDeliveryService into P2pTransport, not use EmbeddedP2pDeliveryService and implement the traits directly on it?
There was a problem hiding this comment.
The issue here is who is the owner of the Transport trait?
Transport trait is the result of the ChatClient being based on threaded model - it mandates that a DS uses a crossbeam queue to pass events across threads.
Given this requirement is unique to ChatClient, it doesn't quite make sense to force all DS's operate in this manner.
The approach is to use the newtype pattern to implement Transport where its needed. In the future this can be cleaned further, by building a blanket impl that runs the DS in a thread and captures output into a queue, so this does not require to be implemented.
4e280b5 to
8784a43
Compare
Rename components update deps WIP Remove requirement for build.rs in chat-cli fix imports update linux flake Linter fixes fix build in linux
8784a43 to
c73eb90
Compare
Problem
The embedded version of LogosDelivery is only available via chat-cli.
This:
Solution
chat-cli/logos-deliverytransport tocomponents/EmbeddedP2pDeliveryServiceBuild Updates
extensions/components/build.rs— single source of truth: finds the lib (env override → nix auto-build), stamps an absolute install name (macOS install_name_tool, Linux patchelf --set-soname), emits the propagating link directives.bin/chat-cli/build.rs— deleted.extensions/components/src/lib.rs— export gated on logos_delivery to stay consistent with the module gate in delivery.rs, so the type is present exactly when the lib is available.Consuming
EmbeddedP2pDeliveryServiceis available to applications via cargo import.components = { ..., features = ["embedded_p2p_delivery"]}