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

Make region and bucket as optional and always set the endpoint #2

Merged
merged 6 commits into from
Aug 22, 2023

Conversation

philss
Copy link
Member

@philss philss commented Aug 17, 2023

We need to relax a little bit the region configuration, because it's not required for every service that is S3 compatible.

We also relax the requirement of the bucket, because in some situations we cannot know the bucket name from a "bucket URL". We assume that the bucket name is in the endpoint, in case bucket is not provided.

This is also moving the :bucket field from the FSS.S3.Entry to FSS.S3.Config struct.

@philss philss requested a review from josevalim August 17, 2023 17:21
These are changes necessary to support the usage when only the bucket
url is known.
@philss philss changed the title Add function to parse configuration from a bucket URL Make region and bucket as optional and always set the endpoint Aug 18, 2023
Also make that attribute required in the typespecs.
philss added a commit to elixir-explorer/explorer that referenced this pull request Aug 19, 2023
This makes Explorer treat the "endpoint" as already containing the bucket
name, and force the virtual host style in order to make Polars ignore the
bucket name.

Since FSS is always building the correct endpoint in case the user does not
provide, we changed the endpoint to be required in the Rust struct.

This work is related to elixir-explorer/fss#2
lib/fss/s3.ex Outdated Show resolved Hide resolved
This is going to treat the endpoint differently depending on
bucket name. It is also going to make `:bucket` nil if we can
build a virtual-host style endpoint.

The rules are more or less the following:

* Endpoint is given
  * And bucket is an empty string (s3:///path): keep bucket nil
  * Otherwise keep both endpoint and bucket in config
* Endpoint is nil
  * Bucket has dots: keep the endpoint _without_ the bucket, fill in bucket field
  * Bucket does not have dots: keep the endpoint with bucket, bucket is nil
@philss philss merged commit bf54b55 into main Aug 22, 2023
1 check passed
@philss philss deleted the ps-add-parse-bucket-url branch August 22, 2023 14:22
philss added a commit to elixir-explorer/explorer that referenced this pull request Aug 22, 2023
philss added a commit to elixir-explorer/explorer that referenced this pull request Aug 23, 2023
This makes Explorer treat the "endpoint" as already containing the bucket
name, and force the virtual host style in order to make Polars ignore the
bucket name.

Since FSS is always building the correct endpoint in case the user does not
provide, we changed the endpoint to be required in the Rust struct.

This work is related to elixir-explorer/fss#2
philss added a commit to elixir-explorer/explorer that referenced this pull request Aug 23, 2023
philss added a commit to elixir-explorer/explorer that referenced this pull request Aug 23, 2023
* Fix FSS.S3 support when bucket is not provided

This makes Explorer treat the "endpoint" as already containing the bucket
name, and force the virtual host style in order to make Polars ignore the
bucket name.

Since FSS is always building the correct endpoint in case the user does not
provide, we changed the endpoint to be required in the Rust struct.

This work is related to elixir-explorer/fss#2

* Fix with suggestions from PR

It addresses José's suggestions to simplify the endpoint.

* Update FSS after merging PR

PR merged: elixir-explorer/fss#2

* Update FSS to the latest version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants