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

[PR] feat(core): Add enabled for Sceheme [incubator-opendal]

Xuanwo opened a new pull request, #3331:
URL: https://github.com/apache/incubator-opendal/pull/3331

   Close https://github.com/apache/incubator-opendal/issues/3329


-- 
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(core): Add enabled for Scheme [incubator-opendal]

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


##########
core/src/types/scheme.rs:
##########
@@ -134,6 +135,99 @@ impl Scheme {
     pub fn into_static(self) -> &'static str {
         self.into()
     }
+
+    /// Get all enabled schemes.
+    ///
+    /// OpenDAL could be compiled with different features, which will enable different schemes.
+    /// This function returns all enabled schemes so users can make decisions based on it.
+    pub fn enabled() -> HashSet<Scheme> {

Review Comment:
   Any suggestions?



-- 
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(core): Add enabled for Scheme [incubator-opendal]

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


##########
core/src/types/scheme.rs:
##########
@@ -134,6 +135,99 @@ impl Scheme {
     pub fn into_static(self) -> &'static str {
         self.into()
     }
+
+    /// Get all enabled schemes.
+    ///
+    /// OpenDAL could be compiled with different features, which will enable different schemes.
+    /// This function returns all enabled schemes so users can make decisions based on it.
+    pub fn enabled() -> HashSet<Scheme> {

Review Comment:
   I've added this code snippet to the examples.



-- 
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(core): Add enabled for Scheme [incubator-opendal]

Posted by "suyanhanx (via GitHub)" <gi...@apache.org>.
suyanhanx commented on code in PR #3331:
URL: https://github.com/apache/incubator-opendal/pull/3331#discussion_r1363161966


##########
core/src/types/scheme.rs:
##########
@@ -134,6 +135,99 @@ impl Scheme {
     pub fn into_static(self) -> &'static str {
         self.into()
     }
+
+    /// Get all enabled schemes.
+    ///
+    /// OpenDAL could be compiled with different features, which will enable different schemes.
+    /// This function returns all enabled schemes so users can make decisions based on it.
+    pub fn enabled() -> HashSet<Scheme> {

Review Comment:
   I didn't see how to call it. If you decide where and how it will be used, I think we can settle on a name.



-- 
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(core): Add enabled for Scheme [incubator-opendal]

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


##########
core/src/types/scheme.rs:
##########
@@ -134,6 +135,99 @@ impl Scheme {
     pub fn into_static(self) -> &'static str {
         self.into()
     }
+
+    /// Get all enabled schemes.
+    ///
+    /// OpenDAL could be compiled with different features, which will enable different schemes.
+    /// This function returns all enabled schemes so users can make decisions based on it.
+    pub fn enabled() -> HashSet<Scheme> {

Review Comment:
   I think the name is clear enough:
   
   ```rust
   let enabled_schemes = Scheme::enabled();
   if !enabled_schemes.contains(Scheme::S3) {
      return Err(anyhow!("s3 support is not enabled"))
   }
   ```



-- 
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(core): Add enabled for Scheme [incubator-opendal]

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


-- 
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(core): Add enabled for Scheme [incubator-opendal]

Posted by "suyanhanx (via GitHub)" <gi...@apache.org>.
suyanhanx commented on code in PR #3331:
URL: https://github.com/apache/incubator-opendal/pull/3331#discussion_r1363159840


##########
core/src/types/scheme.rs:
##########
@@ -134,6 +135,99 @@ impl Scheme {
     pub fn into_static(self) -> &'static str {
         self.into()
     }
+
+    /// Get all enabled schemes.
+    ///
+    /// OpenDAL could be compiled with different features, which will enable different schemes.
+    /// This function returns all enabled schemes so users can make decisions based on it.
+    pub fn enabled() -> HashSet<Scheme> {

Review Comment:
   Does the naming here need to be more specific?



-- 
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(core): Add enabled for Scheme [incubator-opendal]

Posted by "suyanhanx (via GitHub)" <gi...@apache.org>.
suyanhanx commented on code in PR #3331:
URL: https://github.com/apache/incubator-opendal/pull/3331#discussion_r1363163187


##########
core/src/types/scheme.rs:
##########
@@ -134,6 +135,99 @@ impl Scheme {
     pub fn into_static(self) -> &'static str {
         self.into()
     }
+
+    /// Get all enabled schemes.
+    ///
+    /// OpenDAL could be compiled with different features, which will enable different schemes.
+    /// This function returns all enabled schemes so users can make decisions based on it.
+    pub fn enabled() -> HashSet<Scheme> {

Review Comment:
   If that's the case, I think it's good enough.



-- 
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