You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by "meteorgan (via GitHub)" <gi...@apache.org> on 2024/12/25 14:01:16 UTC

[PR] feat(integrations/object_store): add AmazonS3Builder [opendal]

meteorgan opened a new pull request, #5456:
URL: https://github.com/apache/opendal/pull/5456

   # Which issue does this PR close?
   
   <!--
   We generally require a GitHub issue to be filed for all bug fixes and enhancements. You can link an issue to this PR using the GitHub syntax. For example `Closes #123` indicates that this PR will close issue #123.
   -->
   
   Part of #5190
   
   # Rationale for this change
   
   <!--
   Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed.
   Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes.
   -->
   
   # What changes are included in this PR?
   
   <!--
   There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR.
   -->
   Add `AmazonS3Builder`, similar to `object_store::aws::AmazonS3Builder`, so users can use it to build an `OpendalStore` directly. This eliminates the need for users to understand concepts like `operator`, `S3`  in `OpenDAL`
   
   # Are there any user-facing changes?
   Yes,  after Adding this new feature, users can use the new API, I'll update the document later.
   
   <!--
   If there are user-facing changes then we may require documentation to be updated before approving the PR.
   -->
   
   <!---
   If there are any breaking changes to public APIs, please add the `breaking-changes` label.
   -->
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat(integrations/object_store): add AmazonS3Builder [opendal]

Posted by "meteorgan (via GitHub)" <gi...@apache.org>.
meteorgan commented on code in PR #5456:
URL: https://github.com/apache/opendal/pull/5456#discussion_r2031203280


##########
integrations/object_store/src/s3_builder.rs:
##########
@@ -0,0 +1,97 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use crate::utils::format_object_store_error;
+use crate::OpendalStore;
+use opendal::services::S3;
+use opendal::Operator;
+
+pub struct AmazonS3Builder {

Review Comment:
   > Hi, my original idea was to build an Operator from the `AmazonS3Builder` in the object_store. 
   
   After reconsidering this issue, I'm wondering why we don't simply build `OpendalStore` directly from `AmazonS3Builder`.
   
   > Do you think that would be more useful? Or are both ideas not practical, and users are unlikely to use the APIs this way?
   
   I'm not entirely certain about this question, as I'm not currently a user. If  I had previously used `object_store`, I might find it familiar and convenient to build `OpendalStore`.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat(integrations/object_store): add AmazonS3Builder [opendal]

Posted by "meteorgan (via GitHub)" <gi...@apache.org>.
meteorgan commented on code in PR #5456:
URL: https://github.com/apache/opendal/pull/5456#discussion_r2052136404


##########
integrations/object_store/src/s3_builder.rs:
##########
@@ -0,0 +1,148 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use crate::utils::format_object_store_error;
+use crate::OpendalStore;
+use object_store::aws::AmazonS3ConfigKey;
+use opendal::services::S3;
+use opendal::Operator;
+
+pub struct S3Builder {
+    builder: S3,
+}
+
+impl Default for S3Builder {
+    fn default() -> Self {
+        Self::new()
+    }
+}
+
+impl S3Builder {
+    pub fn new() -> Self {
+        S3Builder {
+            builder: S3::default(),
+        }
+    }
+
+    pub fn root(mut self, root_path: impl Into<String>) -> Self {

Review Comment:
   Yes, I added a function `new_from_aws_s3_builder` between lines 101 and 148. Would you prefer to keep only `new_from_aws_s3_builder` ?



##########
integrations/object_store/src/s3_builder.rs:
##########
@@ -0,0 +1,148 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use crate::utils::format_object_store_error;
+use crate::OpendalStore;
+use object_store::aws::AmazonS3ConfigKey;
+use opendal::services::S3;
+use opendal::Operator;
+
+pub struct S3Builder {
+    builder: S3,
+}
+
+impl Default for S3Builder {
+    fn default() -> Self {
+        Self::new()
+    }
+}
+
+impl S3Builder {
+    pub fn new() -> Self {
+        S3Builder {
+            builder: S3::default(),
+        }
+    }
+
+    pub fn root(mut self, root_path: impl Into<String>) -> Self {

Review Comment:
   Yes, I added a function `new_from_aws_s3_builder` between lines 101 and 148. Would you prefer to keep only it ?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat(integrations/object_store): add AmazonS3Builder [opendal]

Posted by "Xuanwo (via GitHub)" <gi...@apache.org>.
Xuanwo commented on code in PR #5456:
URL: https://github.com/apache/opendal/pull/5456#discussion_r2031274437


##########
integrations/object_store/src/s3_builder.rs:
##########
@@ -0,0 +1,97 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use crate::utils::format_object_store_error;
+use crate::OpendalStore;
+use opendal::services::S3;
+use opendal::Operator;
+
+pub struct AmazonS3Builder {

Review Comment:
   > I'm wondering why we don't simply build `OpendalStore` directly from `AmazonS3Builder`.
   
   That's really a great idea. I like it.
   
   > I might find it familiar and convenient to build OpendalStore from AmazonS3Builder.
   
   Interesting. Let's continue this one.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat(integrations/object_store): add AmazonS3Builder [opendal]

Posted by "Xuanwo (via GitHub)" <gi...@apache.org>.
Xuanwo commented on code in PR #5456:
URL: https://github.com/apache/opendal/pull/5456#discussion_r2052177487


##########
integrations/object_store/src/s3_builder.rs:
##########
@@ -0,0 +1,148 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use crate::utils::format_object_store_error;
+use crate::OpendalStore;
+use object_store::aws::AmazonS3ConfigKey;
+use opendal::services::S3;
+use opendal::Operator;
+
+pub struct S3Builder {
+    builder: S3,
+}
+
+impl Default for S3Builder {
+    fn default() -> Self {
+        Self::new()
+    }
+}
+
+impl S3Builder {
+    pub fn new() -> Self {
+        S3Builder {
+            builder: S3::default(),
+        }
+    }
+
+    pub fn root(mut self, root_path: impl Into<String>) -> Self {

Review Comment:
   How about just keeping `OpendalStore::new_amazon_s3(builder: AmazonS3Builder)`?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat(integrations/object_store): add AmazonS3Builder [opendal]

Posted by "meteorgan (via GitHub)" <gi...@apache.org>.
meteorgan commented on code in PR #5456:
URL: https://github.com/apache/opendal/pull/5456#discussion_r2031203280


##########
integrations/object_store/src/s3_builder.rs:
##########
@@ -0,0 +1,97 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use crate::utils::format_object_store_error;
+use crate::OpendalStore;
+use opendal::services::S3;
+use opendal::Operator;
+
+pub struct AmazonS3Builder {

Review Comment:
   > Hi, my original idea was to build an Operator from the `AmazonS3Builder` in the object_store. 
   
   After reconsidering this issue, I'm wondering why we don't simply build `OpendalStore` directly from `AmazonS3Builder`.
   
   > Do you think that would be more useful? Or are both ideas not practical, and users are unlikely to use the APIs this way?
   
   I'm not entirely certain about this question, as I'm not currently a user. If  I had previously used `object_store`, I might find it familiar and convenient to build `OpendalStore` from `AmazonS3Builder`.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat(integrations/object_store): add AmazonS3Builder [opendal]

Posted by "Xuanwo (via GitHub)" <gi...@apache.org>.
Xuanwo commented on code in PR #5456:
URL: https://github.com/apache/opendal/pull/5456#discussion_r2031071923


##########
integrations/object_store/src/s3_builder.rs:
##########
@@ -0,0 +1,97 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use crate::utils::format_object_store_error;
+use crate::OpendalStore;
+use opendal::services::S3;
+use opendal::Operator;
+
+pub struct AmazonS3Builder {

Review Comment:
   Hi, my original idea was to build an Operator from the `AmazonS3Builder` in the object_store. Do you think that would be more useful? Or are both ideas not practical, and users are unlikely to use the APIs this way?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat(integrations/object_store): add AmazonS3Builder [opendal]

Posted by "Xuanwo (via GitHub)" <gi...@apache.org>.
Xuanwo commented on code in PR #5456:
URL: https://github.com/apache/opendal/pull/5456#discussion_r2051737733


##########
integrations/object_store/src/s3_builder.rs:
##########
@@ -0,0 +1,148 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use crate::utils::format_object_store_error;
+use crate::OpendalStore;
+use object_store::aws::AmazonS3ConfigKey;
+use opendal::services::S3;
+use opendal::Operator;
+
+pub struct S3Builder {
+    builder: S3,
+}
+
+impl Default for S3Builder {
+    fn default() -> Self {
+        Self::new()
+    }
+}
+
+impl S3Builder {
+    pub fn new() -> Self {
+        S3Builder {
+            builder: S3::default(),
+        }
+    }
+
+    pub fn root(mut self, root_path: impl Into<String>) -> Self {

Review Comment:
   Mapping all APIs from `object_store` seems like a lot of work. Could we just accept an `object_store` Builder instead?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat(integrations/object_store): add AmazonS3Builder [opendal]

Posted by "Xuanwo (via GitHub)" <gi...@apache.org>.
Xuanwo merged PR #5456:
URL: https://github.com/apache/opendal/pull/5456


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat(integrations/object_store): add AmazonS3Builder [opendal]

Posted by "meteorgan (via GitHub)" <gi...@apache.org>.
meteorgan commented on PR #5456:
URL: https://github.com/apache/opendal/pull/5456#issuecomment-2786628858

   I've added a new method `OpendalStore::new_from_aws_s3_builder`, while keeping the methods in `S3Builder` public. Here are my thoughts:
   1. For users familiar with `object_store`, they can use `new_from_asw_s3_builder` to build `OpendalStore` directly.
   2. For other users, they can utilize `S3Builder` without needing to understand concepts like `operator` and `S3` in `OpenDAL`. Additionally, I've intentionally aligned the API in `S3Builder` with `object_store::AmazonS3Builder` in both naming and signature.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org