-
-
Notifications
You must be signed in to change notification settings - Fork 272
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
Replace reqwes
t with http
and hyper
, and tower
#297
Conversation
Hey @XAMPPRocky , this is still a WIP, I am just pushing this here to indicate that it is being worked on. A few I am planning to do:
But thus far, I have a question:
|
reqwes
t with http
and hyper
, and tower
I'd need to see the service code in kube and this more, but just from your description. My initial thought for the solution to this problem is to have the service wrapped in a |
Service in Kube does it via https://docs.rs/tower/latest/tower/buffer/struct.Buffer.html |
rename url -> route where applicable revert to older version of base64 fix more instances with missing /
…ule) requires async runtime: https://users.rust-lang.org/t/no-reactor-running-when-calling-runtime-spawn/81256. add tracing as a feature
another potential improvement is to replace url lib completely with hyper::Uri, and hyper_serde crate, though, it does become a little redundant to annotate Uri fields with
annotation... I think for now it is better to keep the URL crate for serialization/deserialization operations. Plus, I am not entirely sure how hyper_serde behaves when uri is wrapped around constructs like Option |
Also, could you re-approve the workflow rerun? I think all works on my end, just want to make sure it compiles in CI |
I worked around the base URI service issue by making it the outer layer, which wraps BufferService inside. This essentially means that we are only full cloning the base_uri service when making .clone() call, everything else is a shallow copy offered by BufferService |
At this point, I think this is almost done. The few things that are left are: implement some retry layer(hidden behind retry feature, just like timeout), and fix docs |
seems like openSSL issue on windows. I will try to build it on that target system edit: ended up using hyper-tls instead |
A few things I am not sure what to decide on: Currently, the This is a rather opinionated approach and leaves little room for customization in terms of adding your own layers directly into the builder. If the end user would like to introduce some additional layer (say metrics layer before, or after retry), or replace the current implementation with their own (e.g. custom tracing), or caching(#175), they would have to use Octocrab::new() and construct their own service from scratch, which could lead to some issues if developers are not careful(e.g. while Octocrab::new does take care of adding BaseUri layer, it doesn't ensure that service contains necessary layers, like ExtraHeaders for auth). We could leave it as is, we would just have to provide some good examples(or reference the OctocrabBuilder::build function) Another way we could go about it is to make the Octocrab Builder completely unopinionated, and let users specify their own layers from scratch(kube-rs way):
This has a plus since it makes OctocrabBuilder reusable for custom clients. However, this makes the configuration slightly more complicated for users who are new or aren't too interested in customizing their services. This also leaves a lot of room for potential pitfalls(forgetting ExtraHeader Layer for auth, not enabling tls, etc) There are approaches that could be implemented by combining both:
I am personally leaning more towards current implementation, and backing it up with better examples on how to construct custom clients |
…ule) requires async runtime: https://users.rust-lang.org/t/no-reactor-running-when-calling-runtime-spawn/81256. add tracing as a feature
…ith_layer, Config, etc)
- add new_empty to facilitate bare bones octocrab builder. Point fn new to fn default to make changes backward compatible. - add base_url function, and point it to base_uri with deprecation notice
# Conflicts: # src/api/actions.rs # src/api/activity/notifications.rs # src/api/apps.rs # src/api/events.rs # src/api/repos.rs # src/api/repos/events.rs # src/error.rs # src/lib.rs # src/page.rs # tests/repos_stargazers_tests.rs # tests/team_invitations_tests.rs # tests/team_members_tests.rs
Wired, GitHub UI merge conflict resolution is a little different than my IDEs "Sync Fork"... Merge conflicts should be resolved now...? |
Thank you for your PR, and congrats on your first contribution! 🎉 |
I think there were a few typos in the routes. Hopefully fixed in #320 |
#[tokio::test] | ||
async fn parametrize_uri_valid() { | ||
//Previously, invalid characters were handled by url lib's parse function. | ||
//Todo: should we handle encoding of uri routes ourselves? |
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.
I think the problem is that label names may be part of the route and can contain any utf-8. See #323
Fixes #99