You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by GitBox <gi...@apache.org> on 2023/03/25 10:26:28 UTC

[GitHub] [incubator-opendal] knight42 created a discussion: Allow users to opt-out creating `root` dir when building `Fs` backend

GitHub user knight42 created a discussion: Allow users to opt-out creating `root` dir when building `Fs` backend

https://github.com/apache/incubator-opendal/blob/a04a724059d7631318cb1543382b7462190f43eb/core/src/services/fs/backend.rs#L141-L163

Currently when creating `Fs` backend, OpenDAL will always create the `root` dir even if users intend to read data from the `Fs` backend, which might suprise users.

I propose we could create the necessary dirs in the implemetation of `Accessor::write` and `Accessor::create` rather than when we are building `Fs` backend. Or at least provide users with a option to opt-out this behavior.

GitHub link: https://github.com/apache/incubator-opendal/discussions/1765

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


[GitHub] [incubator-opendal] knight42 added a comment to the discussion: Allow users to opt-out creating `root` dir when building `Fs` backend

Posted by GitBox <gi...@apache.org>.
GitHub user knight42 added a comment to the discussion: Allow users to opt-out creating `root` dir when building `Fs` backend

> all serivces should stick to / as root to make the internal logic cleaner.

Got it, this is a convention that I am not aware of. To follow this convention, I think `oli` should turn a relative path into an absolute path when parseing location. I could do that in a follow-up PR.

GitHub link: https://github.com/apache/incubator-opendal/discussions/1765#discussioncomment-5425903

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


[GitHub] [incubator-opendal] Xuanwo added a comment to the discussion: Allow users to opt-out creating `root` dir when building `Fs` backend

Posted by GitBox <gi...@apache.org>.
GitHub user Xuanwo added a comment to the discussion: Allow users to opt-out creating `root` dir when building `Fs` backend

I don't understand the purpose of creating a file system backend on a non-existent root. For instance, if a user creates a backend with `/not_exist` and tries to read `hello.txt`, they will receive a NotFound error. This can cause confusion for the user who then needs to figure out what went wrong.

I would prefer to return an error instead, but this change will break the fs backend. Let's keep this issue open and see if others share the same concern.

GitHub link: https://github.com/apache/incubator-opendal/discussions/1765#discussioncomment-5425810

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


[GitHub] [incubator-opendal] Xuanwo added a comment to the discussion: Allow users to opt-out creating `root` dir when building `Fs` backend

Posted by GitBox <gi...@apache.org>.
GitHub user Xuanwo added a comment to the discussion: Allow users to opt-out creating `root` dir when building `Fs` backend

> Users might not create a fs backend with a non-existent root on purpose.

That's true.

> For instance I once tested `oli cat` by reading a local file and I mistyped the path, like `oli cat /tmp/not-exist/foo`, and then a dir named `non-exist` was created under `/tmp`.

Actually, `oli` must avoid using `/tmp/not-exist` as the root directory. Instead, all serivces should stick to `/` as root to make the internal logic cleaner.

> Another case is that if I run the test [test_parse_fs_location](https://github.com/apache/incubator-opendal/blob/0069c92af7f6a4380653caa01276776031ef03e9/bin/oli/src/config/mod.rs#L304-L312) locally, a dir named `foo/bar` will be created under PWD, which supprises me as no read/write operation is actually performed.

This is the same issue as I statemented in last comment.

---

Thank you for the proposal, but I don't think it's a significant enough issue to warrant a change.

GitHub link: https://github.com/apache/incubator-opendal/discussions/1765#discussioncomment-5425812

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


[GitHub] [incubator-opendal] knight42 added a comment to the discussion: Allow users to opt-out creating `root` dir when building `Fs` backend

Posted by GitBox <gi...@apache.org>.
GitHub user knight42 added a comment to the discussion: Allow users to opt-out creating `root` dir when building `Fs` backend

> I don't understand the purpose of creating a file system backend on a non-existent root.

Users might not create a fs backend with a non-existent root on purpose. 

For instance I once tested `oli cat` by reading a local file and I mistyped the path, like `oli cat /tmp/not-exist/foo`, and then a dir named `non-exist` was created under `/tmp`. 

Another case is that if I run the test [test_parse_fs_location](https://github.com/apache/incubator-opendal/blob/0069c92af7f6a4380653caa01276776031ef03e9/bin/oli/src/config/mod.rs#L304-L312) locally, a dir named `foo/bar` will be created under PWD, which supprises me as no read/write operation is actually performed.

GitHub link: https://github.com/apache/incubator-opendal/discussions/1765#discussioncomment-5425811

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