Skip to content
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!: use Service generic in transport connections #76

Merged
merged 8 commits into from May 13, 2024

Conversation

Frando
Copy link
Member

@Frando Frando commented May 6, 2024

This changes the transport connection and endpoint struct to be generic over S: Service instead of In: RpcMessage, Out: RpcMessage. With this change, the public API surface of a crate using quic-rpc can be reduced to only make the service struct public and hide the RPC message types.

E.g. in Iroh, a quic client would now be
Client<QuinnConnection<RpcService>>
instead of
Client<QuinnConnection<ProviderRequest, ProviderResponse>>

Breaking changes

The change breaks all transport types, they are now generic over S: Service instead of In: RpcMessage, Out: RpcMessage.

@dignifiedquire
Copy link
Contributor

much nicer 🔥

@rklaehn
Copy link
Collaborator

rklaehn commented May 13, 2024

OK, so I am trying to come up with cases where this is limiting, but so far can't find any. Also it seems that transport::Connection is unaffected and still has two type parameters. So LGTM.

maybe it gets rid of the errors
to get rid of some weird warnings about non_local_definitions from
derive_more macros
@rklaehn rklaehn self-requested a review May 13, 2024 12:20
@rklaehn rklaehn merged commit 64ed5ef into main May 13, 2024
15 checks passed
@rklaehn rklaehn deleted the refactor/service-conn branch May 13, 2024 12:59
github-merge-queue bot pushed a commit to n0-computer/iroh that referenced this pull request May 24, 2024
## Description

Adapts iroh for n0-computer/quic-rpc#76

Wit this change, a quic client is
`pub type QuicIroh = Iroh<QuinnConnection<RpcService>>`
instead of
`pub type QuicIroh = Iroh<QuinnConnection<ProviderRequest,
ProviderResponse>>`

## Breaking Changes
* Increased mimimal supported rust version (MSRV) from 1.75 to 1.76
* The generics of the iroh clients changed: Instead of taking
`ProviderRequest, ProviderResponse` as generics, they now take
`RpcService`

## Notes & open questions

<!-- Any notes, remarks or open questions you have to make about the PR.
-->

## Change checklist

- [x] Self-review.
- [x] Documentation updates if relevant.
- [x] Tests if relevant.
- [x] All breaking changes documented.

---------

Co-authored-by: dignifiedquire <me@dignifiedquire.com>
github-merge-queue bot pushed a commit to n0-computer/iroh that referenced this pull request May 24, 2024
## Description

Adapts iroh for n0-computer/quic-rpc#76

Wit this change, a quic client is
`pub type QuicIroh = Iroh<QuinnConnection<RpcService>>`
instead of
`pub type QuicIroh = Iroh<QuinnConnection<ProviderRequest,
ProviderResponse>>`

## Breaking Changes
* Increased mimimal supported rust version (MSRV) from 1.75 to 1.76
* The generics of the iroh clients changed: Instead of taking
`ProviderRequest, ProviderResponse` as generics, they now take
`RpcService`

## Notes & open questions

<!-- Any notes, remarks or open questions you have to make about the PR.
-->

## Change checklist

- [x] Self-review.
- [x] Documentation updates if relevant.
- [x] Tests if relevant.
- [x] All breaking changes documented.

---------

Co-authored-by: dignifiedquire <me@dignifiedquire.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants