From bf8c0ca5c507b419299892bb57c14f4fe2b411df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BCdiger=20Klaehn?= Date: Thu, 20 Jun 2024 14:18:35 +0300 Subject: [PATCH] refactor(iroh): use boxed client to get rid of the C type parameter (#2353) ## Description I implemented a boxed connection and a boxed service endpoint in quic-rpc. With this we can get rid of the `` type parameter and make the quinn and mem client/server side the same type. The nice thing about this approach is that it will not lead to additonal boxing on the mem path, and for the quinn or whatever io path the boxing will probably not matter that much compared to all the other things going on. ## Breaking Changes Breaking changes affect solely the iroh client. The iroh client as well as all the subsystem clients no longer need a type parameter C to distinguish between an in memory connection and a remote connection. - Code that directly uses the clients should be unaffected. E.g. `iroh.blobs().read(hash)` will still compile. - Code that takes a client as an argument will have to be modified to remove the type parameter. E.g. ```rust fn download(client: blobs::Client) where C: ... ``` will become just ```rust fn download(client: blobs::Client) ``` The type aliases `iroh::client::MemIroh` and `iroh::client::QuicIroh` for an iroh client specialized for memory or remote use have been retained, but will be removed in one of the next releases. In detail: - iroh::client::Iroh loses the `C` type parameter - iroh::client::blobs::Client loses the `C` type parameter - iroh::client::tags::Client loses the `C` type parameter - iroh::client::authors::Client loses the `C` type parameter - iroh::client::docs::Client loses the `C` type parameter ## Notes & open questions Note: I marked the old type aliases MemIroh, QuicIroh etc as deprecated. That does not seem to actually do anything, but just serves as a reminder to remove them in the near future. ## Change checklist - [x] Self-review. - [x] Documentation updates if relevant. ~~- [x] Tests if relevant.~~ - [x] All breaking changes documented. --- Cargo.lock | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2c2ffd4b8b..0c680d19b7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4041,10 +4041,11 @@ dependencies = [ [[package]] name = "quic-rpc" -version = "0.10.1" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0d69b05325e19956f123fce85ebc4d99226552a0bb24bba4c886106297e708b" +checksum = "5e56dc58272a3f9c151b1c3a6df0e3caca083fd843b337e60f706fae2d974b6b" dependencies = [ + "anyhow", "bincode", "derive_more", "educe",