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

In java binding, how to know what `Construct operator` requires?

GitHub user linghengqian created a discussion: In java binding, how to know what `Construct operator` requires?

- I admit this is a naive question, but I don't seem to notice any documentation explaining this.
- In https://opendal.apache.org/docs/quickstart#demo-1 , there is code like this,
```java
// Configure service
final Map<String, String> conf = new HashMap<>();
conf.put("root", "/tmp");
// Construct operator
final Operator op = Operator.of("fs", conf);
// Write data
op.write("hello.txt", "Hello, World!").join();
// Read data
final byte[] bs = op.read("hello.txt").join();
// Delete
op.delete("hello.txt").join();
```
- Of course, I certainly don't believe that OpenDAL's java binding only supports `fs`. But how do I know that `fs` requires a `Map` containing a key-value pair called `root`? Also, how do I know the name of the other filesystems besides `Operator.of("fs", conf)`?
- I assume the string for `fs` comes from the image below?
- ![image](https://github.com/user-attachments/assets/f1342817-a8cd-43f6-a568-58874a4aaafe)
- I see https://github.com/apache/opendal/issues/4279 is not done yet. It sounds like the documentation needs to properly state that users of the Java binding need to be able to read Rust source code? Documents like https://vuejs.org/guide/introduction.html#what-is-vue require readers of Vue's documentation to know HTML, CSS, and JavaScript at specific URLs in advance. Does the Java binding documentation for OpenDAL also need to state the URL of the Rust documentation?

- ![image](https://github.com/user-attachments/assets/d2cf3c09-c065-481c-88f4-a7ab078cd0c9)



GitHub link: https://github.com/apache/opendal/discussions/5402

----
This is an automatically sent email for dev@opendal.apache.org.
To unsubscribe, please send an email to: dev-unsubscribe@opendal.apache.org


Re: In java binding, how to know what `Construct operator` requires?

Posted by "Xuanwo (via GitHub)" <gi...@apache.org>.
GitHub user Xuanwo added a comment to the discussion: In java binding, how to know what `Construct operator` requires?

Thank you @linghengqian for reporting this. This is an issue we are still working on. We have developed a new configuration system and will implement it for bindings so that all users can have a static list of available configuration values.

Until we have completed that, users may need to refer to the Rust documentation for the available configuration values. Apologies for the inconvenience.

GitHub link: https://github.com/apache/opendal/discussions/5402#discussioncomment-11487099

----
This is an automatically sent email for dev@opendal.apache.org.
To unsubscribe, please send an email to: dev-unsubscribe@opendal.apache.org


Re: In java binding, how to know what `Construct operator` requires?

Posted by "tisonkun (via GitHub)" <gi...@apache.org>.
GitHub user tisonkun edited a comment on the discussion: In java binding, how to know what `Construct operator` requires?

Anyway we may improve the Java API docs. And I recently found some potentially additional options that cannot be directly mapped to Rust's config, like using a no_proxy client ..

GitHub link: https://github.com/apache/opendal/discussions/5402#discussioncomment-11487120

----
This is an automatically sent email for dev@opendal.apache.org.
To unsubscribe, please send an email to: dev-unsubscribe@opendal.apache.org


Re: In java binding, how to know what `Construct operator` requires?

Posted by "tisonkun (via GitHub)" <gi...@apache.org>.
GitHub user tisonkun added a comment to the discussion: In java binding, how to know what `Construct operator` requires?

Not the Rust source code, but the API docs: https://docs.rs/opendal/latest/opendal/services/index.html

For example, https://docs.rs/opendal/latest/opendal/services/struct.S3.html will tell you the options that can be used for constructing an S3 operator.

GitHub link: https://github.com/apache/opendal/discussions/5402#discussioncomment-11487083

----
This is an automatically sent email for dev@opendal.apache.org.
To unsubscribe, please send an email to: dev-unsubscribe@opendal.apache.org


Re: In java binding, how to know what `Construct operator` requires?

Posted by "linghengqian (via GitHub)" <gi...@apache.org>.
GitHub user linghengqian closed a discussion: In java binding, how to know what `Construct operator` requires?

- I admit this is a naive question, but I don't seem to notice any documentation explaining this.
- In https://opendal.apache.org/docs/quickstart#demo-1 , there is code like this,
```java
// Configure service
final Map<String, String> conf = new HashMap<>();
conf.put("root", "/tmp");
// Construct operator
final Operator op = Operator.of("fs", conf);
// Write data
op.write("hello.txt", "Hello, World!").join();
// Read data
final byte[] bs = op.read("hello.txt").join();
// Delete
op.delete("hello.txt").join();
```
- Of course, I certainly don't believe that OpenDAL's java binding only supports `fs`. But how do I know that `fs` requires a `Map` containing a key-value pair called `root`? Also, how do I know the name of the other filesystems besides `Operator.of("fs", conf)`?
- I assume the string for `fs` comes from the image below?
- ![image](https://github.com/user-attachments/assets/f1342817-a8cd-43f6-a568-58874a4aaafe)
- I see https://github.com/apache/opendal/issues/4279 is not done yet. It sounds like the documentation needs to properly state that users of the Java binding need to be able to read Rust source code? Documents like https://vuejs.org/guide/introduction.html#what-is-vue require readers of Vue's documentation to know HTML, CSS, and JavaScript at specific URLs in advance. Does the Java binding documentation for OpenDAL also need to state the URL of the Rust documentation?

- ![image](https://github.com/user-attachments/assets/d2cf3c09-c065-481c-88f4-a7ab078cd0c9)



GitHub link: https://github.com/apache/opendal/discussions/5402

----
This is an automatically sent email for dev@opendal.apache.org.
To unsubscribe, please send an email to: dev-unsubscribe@opendal.apache.org


Re: In java binding, how to know what `Construct operator` requires?

Posted by "tisonkun (via GitHub)" <gi...@apache.org>.
GitHub user tisonkun added a comment to the discussion: In java binding, how to know what `Construct operator` requires?

Anyway we may improve the Java API docs. And I recently found some extra options that cannot be directly mapped to Rust's config, like using a no_proxy client ..

GitHub link: https://github.com/apache/opendal/discussions/5402#discussioncomment-11487120

----
This is an automatically sent email for dev@opendal.apache.org.
To unsubscribe, please send an email to: dev-unsubscribe@opendal.apache.org


Re: In java binding, how to know what `Construct operator` requires?

Posted by "tisonkun (via GitHub)" <gi...@apache.org>.
GitHub user tisonkun added a comment to the discussion: In java binding, how to know what `Construct operator` requires?

https://github.com/apache/opendal/pull/5503/ This is a PR for generated structured config.

GitHub link: https://github.com/apache/opendal/discussions/5402#discussioncomment-11724703

----
This is an automatically sent email for dev@opendal.apache.org.
To unsubscribe, please send an email to: dev-unsubscribe@opendal.apache.org


Re: In java binding, how to know what `Construct operator` requires?

Posted by "linghengqian (via GitHub)" <gi...@apache.org>.
GitHub user linghengqian added a comment to the discussion: In java binding, how to know what `Construct operator` requires?

> For example, https://docs.rs/opendal/latest/opendal/services/struct.S3.html will tell you the options that can be used for constructing an S3 operator.

- I quickly compared the differences between https://docs.rs/opendal/latest/opendal/services/struct.Fs.html and https://opendal.apache.org/docs/quickstart#java-binding . So Rust's functional programming code,
```rust
let mut builder = Fs::default()
        .root("/tmp");
```
- Corresponding to,
```java
final Map<String, String> conf = new HashMap<>();
conf.put("root", "/tmp");
final Operator op = Operator.of("fs", conf);
```
- Similarly, https://docs.rs/opendal/latest/opendal/services/struct.S3.html#basic-setup ,
```rust
let mut builder = S3::default()
      .root("/path/to/dir")
      .bucket("test")
      .region("us-east-1")
      .endpoint("https://s3.amazonaws.com")
      .access_key_id("access_key_id")
      .secret_access_key("secret_access_key");
```
- Can it correspond to?
```java
final Map<String, String> conf = new HashMap<>();
conf.put("root", "/path/to/dir");
conf.put("bucket", "test");
conf.put("region", "us-east-1");
conf.put("endpoint", "https://s3.amazonaws.com");
conf.put("access_key_id", "access_key_id");
conf.put("secret_access_key", "secret_access_key");
final Operator op = Operator.of("s3", conf);
```
- If this is a reasonable way to convert code across languages, it might be better to give some examples at https://opendal.apache.org/docs/binding-java . 
- I must admit that I am actually a S3 novice, and Amazon China restricts individual developer account registration.

GitHub link: https://github.com/apache/opendal/discussions/5402#discussioncomment-11487180

----
This is an automatically sent email for dev@opendal.apache.org.
To unsubscribe, please send an email to: dev-unsubscribe@opendal.apache.org


Re: In java binding, how to know what `Construct operator` requires?

Posted by "linghengqian (via GitHub)" <gi...@apache.org>.
GitHub user linghengqian added a comment to the discussion: In java binding, how to know what `Construct operator` requires?

Thanks, I will close this discussion.

GitHub link: https://github.com/apache/opendal/discussions/5402#discussioncomment-11724971

----
This is an automatically sent email for dev@opendal.apache.org.
To unsubscribe, please send an email to: dev-unsubscribe@opendal.apache.org