-
Notifications
You must be signed in to change notification settings - Fork 165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(iroh): use boxed client to get rid of the C type parameter #2353
Conversation
# Conflicts: # iroh/src/client.rs # iroh/src/client/authors.rs # iroh/src/client/blobs.rs # iroh/src/client/docs.rs # iroh/src/client/tags.rs # iroh/src/node.rs # iroh/src/node/builder.rs
d4ecad6
to
4bada75
Compare
12cf5de
to
de11d25
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is lovely
They are no longer needed and will be removed soon.
document boxing overhead, some renaming, consistent use of type alias
@rklaehn please add some more details on the breaking changes, otherwise I have to go through the whole PR when writing the changelog |
Added some more text. Is that sufficient? |
thanks, looks great |
…0-computer#2353) ## Description I implemented a boxed connection and a boxed service endpoint in quic-rpc. With this we can get rid of the `<C: ServiceConnection<RpcService>` 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<C>(client: blobs::Client<C>) 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.
…2353) ## Description I implemented a boxed connection and a boxed service endpoint in quic-rpc. With this we can get rid of the `<C: ServiceConnection<RpcService>` 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<C>(client: blobs::Client<C>) 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.
Description
I implemented a boxed connection and a boxed service endpoint in quic-rpc.
With this we can get rid of the
<C: ServiceConnection<RpcService>
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.
will become just
The type aliases
iroh::client::MemIroh
andiroh::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:
C
type parameterC
type parameterC
type parameterC
type parameterC
type parameterNotes & 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] Tests if relevant.