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

feat(object-store): extend Options API for http client #4208

Merged
merged 1 commit into from
May 12, 2023

Conversation

roeap
Copy link
Contributor

@roeap roeap commented May 12, 2023

Which issue does this PR close?

Closes #.

Rationale for this change

This extends #4202 by @tustvold to allow for configuring more options on the client builder via the Options API.

What changes are included in this PR?

Are there any user-facing changes?

@github-actions github-actions bot added the object-store Object Store Interface label May 12, 2023
@@ -33,6 +33,7 @@ async-trait = "0.1.53"
bytes = "1.0"
chrono = { version = "0.4.23", default-features = false, features = ["clock"] }
futures = "0.3"
humantime = "2.1"
Copy link
Contributor Author

@roeap roeap May 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here we introduce a new dependency, but since humantime itself comes dependency-free i felt we can justify this?

The crate has not seen any updates for quite some time, but is relied upon by some of the msot widely used crates, like cargo, clap, and rustsec.

}
}

pub(crate) fn fmt_duration(duration: &ConfigValue<Duration>) -> String {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duration does not implement Display, but we also cannot implement Display for ConfigValue<Duration>, since the compiler believes this may be implemented one day, at which time it would conflict with the generic implementation. Thus i went for a simple function.

@roeap roeap marked this pull request as ready for review May 12, 2023 06:01
@roeap roeap changed the title feat(object-store): extend client option configuration keys feat(object-store): extend Options API for http client May 12, 2023
}
ClientConfigKey::ProxyUrl => self.proxy_url.clone(),
ClientConfigKey::Timeout => self.timeout.as_ref().map(fmt_duration),
ClientConfigKey::UserAgent => self
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might be able to make this more legible by using ?

@tustvold tustvold merged commit 144528f into apache:master May 12, 2023
@roeap roeap deleted the client-config branch May 12, 2023 17:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
object-store Object Store Interface
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants