-
Notifications
You must be signed in to change notification settings - Fork 876
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
Decouple ObjectStore from Reqwest #7183
base: main
Are you sure you want to change the base?
Conversation
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.
The vast majority of this PR is fairly mechanical, but I've highlighted some key areas
|
||
/// The [`Body`] of an [`HttpRequest`] | ||
#[derive(Debug, Clone)] | ||
pub struct HttpRequestBody(Inner); |
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.
We define fixed body types as we need HttpClient to be dyn-compatible (it also makes things slightly easier to follow)
} | ||
} | ||
|
||
pub(crate) struct HttpRequestBuilder { |
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 a crate-private builder that provides an interface similar to reqwest
but which can then be used with the HttpClient
. Unfortunately reqwest::Request
is largely opaque and I couldn't see an obvious way to make use of it.
} | ||
} | ||
|
||
pub(crate) fn add_query_pairs<I, K, V>(uri: &mut Uri, query_pairs: I) |
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.
It is a shame that http::Request uses http::Uri which lacks the ergonomic niceities of Url, so we require some additional shenanigans
|
||
#[derive(Debug, Copy, Clone, PartialEq, Eq)] | ||
#[non_exhaustive] | ||
pub enum HttpErrorKind { |
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 allows the retry logic to work on top of arbitrary HttpClients
inner: RequestError, | ||
} | ||
|
||
impl std::fmt::Display for RetryError { |
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 somewhat lays the ground work for #6377
} | ||
|
||
impl RetryExt for reqwest::RequestBuilder { | ||
impl RetryExt for HttpRequestBuilder { |
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.
We could theoretically remove the extension trait, as HttpRequestBuilder, is not a foreign type. I opted to keep it for now though.
}; | ||
|
||
// Reqwest error variants aren't great, attempt to refine them | ||
let mut source = e.source(); |
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 logic is moved out of retry.rs and reframed in terms of HttpErrorKind
Which issue does this PR close?
Closes #6056
Related to #6818
Related to #7171
Rationale for this change
See tickets
What changes are included in this PR?
Are there any user-facing changes?