-
Notifications
You must be signed in to change notification settings - Fork 863
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
Derive Clone for ObjectStore builders and Make URL Parsing Stricter (#3419) #3424
Conversation
Make URL parsing more strict
/// | ||
/// This is a separate member function to allow fallible computation to | ||
/// be deferred until [`Self::build`] which in turn allows deriving [`Clone`] | ||
fn parse_url(&mut self, url: &str) -> Result<()> { |
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.
Previously invalid URLs would be silently ignored, they now result in an error which I think makes for a better UX
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.
Love it, many thanks!
@@ -365,10 +368,10 @@ pub struct MicrosoftAzureBuilder { | |||
tenant_id: Option<String>, | |||
sas_query_pairs: Option<Vec<(String, String)>>, | |||
authority_host: Option<String>, | |||
url: Option<String>, |
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 MicrosoftAzureBuilder is missing the Clone in the derive list.
object_store/src/aws/mod.rs
Outdated
}, | ||
_ => match prefix.split_once('.') { | ||
// https://<bucket>.s3.<region>.amazonaws.com | ||
Some((b, r)) if r.starts_with("s3.") => b, |
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.
Should we set region
and virtual_hosted_style_request
here before returning the bucket? Otherwise I think the user would have to set these separetely for things to work.
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 we should make sure we cover this case with a test so we are sure it works / and it isn't broken in a future refactoring
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.
Code and tests looks good to me -- though I think we really should add some error coverage
assert_eq!(builder.bucket_name, Some("bucket".to_string())); | ||
|
||
let builder = | ||
AmazonS3Builder::new().with_url("https://bucket.s3.region.amazonaws.com"); | ||
let mut builder = AmazonS3Builder::new(); |
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.
perhaps should we add a test for parsing errors?
(also applies to the other test_urls
functions)
object_store/src/aws/mod.rs
Outdated
}, | ||
_ => match prefix.split_once('.') { | ||
// https://<bucket>.s3.<region>.amazonaws.com | ||
Some((b, r)) if r.starts_with("s3.") => b, |
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 we should make sure we cover this case with a test so we are sure it works / and it isn't broken in a future refactoring
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.
👍
Many thanks! I have been looking into the verde support. The structs re-exported from http::headers do not work out of the box but I am close, I think. Will submit a PR after this one, unless @tustvold already started on it. |
Benchmark runs are scheduled for baseline = b371f41 and contender = 1889e33. 1889e33 is a master commit associated with this PR. Results will be available as each benchmark for each run completes. |
Which issue does this PR close?
Closes #3419
Rationale for this change
What changes are included in this PR?
Are there any user-facing changes?
No, this does not making any breaking changes to released APIs
FYI @roeap perhaps you would be able to review this 🙏