tonic icon indicating copy to clipboard operation
tonic copied to clipboard

Upgrade to http 1.0 and axum 0.7

Open allan2 opened this issue 1 year ago • 14 comments

Hi, I'm working on a PR to upgrade http, http-body, axum, etc.

This affects https://github.com/tokio-rs/axum/issues/2356.

allan2 avatar Nov 28 '23 07:11 allan2

Scoping out upgrading tonic, it appears that this crate is far too large to handle in a single pr. Is it possible to set up a branch on tonic to tackle each of the workspace members?

i.e. I attempted to upgrade tonic-web to http 1.0.1, but because hyper::body::Body is now a trait, not a struct, there are new trait bounds on most of this crates' members. I haven't checked the other members, but I'm guessing the same breaking changes will arise. The docs will also require their respective adjustments,,,unless my assumptions are wrong, here's the enable function signature in tonic-web

From

pub fn enable<S>(service: S) -> CorsGrpcWeb<S>
where
    S: Service<http::Request<hyper::Body>, Response = http::Response<BoxBody>>,
    S: Clone + Send + 'static,
    S::Future: Send + 'static,
    S::Error: Into<BoxError> + Send,

To

pub fn enable<S, B>(service: S) -> CorsGrpcWeb<S, B>
where
    S: Service<http::Request<B>, Response = http::Response<BoxBody>>,
    B: hyper::body::Body,
    S: Clone + Send + 'static,
    S::Future: Send + 'static,
    S::Error: Into<BoxError> + Send,

Can someone more knowledgeable tell me if my assumption is correct here?

dsgallups avatar Dec 06 '23 17:12 dsgallups

@dsgallups Body struct was renamed to Incoming but I am not sure if it can act as drop-in replacement

gautam8404 avatar Dec 07 '23 04:12 gautam8404

Is it possible to set up a branch on tonic to tackle each of the workspace members?

Yes, in fact I will just branch off tonic now and we can work off of main.

LucioFranco avatar Dec 11 '23 19:12 LucioFranco

Ok I created a https://github.com/hyperium/tonic/tree/next branch, @allan2 if you want to target this branch with this work that would be great. I am happier to do smaller PRs. That said as well my gh notificiations are out of control rn so if you need a review from me pls ping me on discord and I will take a look.

LucioFranco avatar Dec 11 '23 19:12 LucioFranco

+1 for this PR

rj76 avatar Dec 14 '23 10:12 rj76

@dsgallups the replacement(s) for the body struct is now in https://docs.rs/http-body-util/0.1.0/http_body_util/

cemoktra avatar Dec 15 '23 07:12 cemoktra

Thanks, I'll see about making a contribution this weekend!

Edit: Are we positive that we should be using the replacement body struct over using anything that implements hyper::body::Body? It just feels like being generic over the body is preferred, unless tonic/grpc is actually constrained to a single option of this type. I'm not knowledgeable enough about tonic to know the answer for this situation. @LucioFranco , could you provide me some pointers so I can make a productive contribution?

dsgallups avatar Dec 15 '23 15:12 dsgallups

Edit: Are we positive that we should be using the replacement body struct over using anything that implements hyper::body::Body? It just feels like being generic over the body is preferred, unless tonic/grpc is actually constrained to a single option of this type. I'm not knowledgeable enough about tonic to know the answer for this situation. @LucioFranco , could you provide me some pointers so I can make a productive contribution?

most of the stuff we used is also in the util crate which is fine to use a replacement for now.

LucioFranco avatar Dec 18 '23 17:12 LucioFranco

Any updates on this?

hariria avatar Jan 13 '24 05:01 hariria

Cc @allan2

hariria avatar Jan 20 '24 06:01 hariria

You can follow the latest work in #1595

allan2 avatar Jan 22 '24 22:01 allan2

I would like to drop a quick update from my part, obviously this upgrade is quite complicated due to how dependent tonic is on hyper for good and bad reasons. As well as historical ones. I don't have a clear plan yet going forward of how I want to solve this that will work for everyone, but I have been spending time thinking about how to do this. So what that means is that people will need to be a bit patient while I find what makes most sense. In the meantime, hyper 0.14 is quite stable and I would recommend any production users to keep using that.

LucioFranco avatar Jan 25 '24 15:01 LucioFranco

Trying to catch up here.

#1583 was the draft and is still open, but it was superceded by #1595.

@allan2 links to #1595 above. @ikrivosheev closed that about a month ago, and nothing was merged.

@alexrudy's #1670 supercedes #1595, and seems to be the new latest and ready-to-go version.

aran avatar May 09 '24 16:05 aran

@aran , hello! Here is finished PR: https://github.com/hyperium/tonic/pull/1670

ikrivosheev avatar May 09 '24 17:05 ikrivosheev

Hello, should this issue be closed after #1670 merge?

egtwp avatar Jun 17 '24 08:06 egtwp