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

feat(webdav): add list and improve create #1330

Merged
merged 60 commits into from Feb 19, 2023
Merged

Conversation

imWildCat
Copy link
Contributor

@imWildCat imWildCat commented Feb 12, 2023

I hereby agree to the terms of the CLA available at: https://databend.rs/dev/policies/cla/

Summary

  • list
    • Define response schema of the list operation from WebDAV service
    • Define response handling
  • create
    • Create directories recursively
      • In the future, we can apply for naive optimization like checking whether a directory exists, before creating dir or file recursively (which might be super expensive)
    • Add MKCOL http method support for creating directories

@imWildCat
Copy link
Contributor Author

Posting this WIP PR because I'm pretty new and a bit worried that I will go on the wrong directory.

Please feel free to point out problems. Thanks in advance!

@imWildCat
Copy link
Contributor Author

imWildCat commented Feb 12, 2023

hyperium/http#587 There's another blocker for this PR, which is to define PROPFIND.

Not a problem anymore

@imWildCat
Copy link
Contributor Author

Still seeing this error:

warning: `opendal-example` (bin "opendal-example") generated 7 warnings
    Finished dev [unoptimized + debuginfo] target(s) in 0.15s
     Running `target/debug/opendal-example`
test_file_content: "f"
Error: Unsupported (permanent) at list, context: { service: webdav } => operation is not supported

Not sure where to fix?

src/services/webdav/backend.rs Outdated Show resolved Hide resolved
src/services/webdav/backend.rs Outdated Show resolved Hide resolved
src/services/webdav/body_request_type.rs Outdated Show resolved Hide resolved
src/services/webdav/backend.rs Show resolved Hide resolved
src/services/webdav/list_response.rs Outdated Show resolved Hide resolved
@imWildCat imWildCat changed the title [WIP] Webdav list op [WIP] WebDAV list op Feb 13, 2023
@imWildCat
Copy link
Contributor Author

@Xuanwo I have to go to sleep today. Will (probably) refine this PR tomorrow.

I noticed some logic error of my implementation at this moment.

Very appreciate your review!

@imWildCat imWildCat changed the title [WIP] WebDAV list op feat: WebDAV list op Feb 13, 2023
@imWildCat imWildCat changed the title feat: WebDAV list op [WIP] feat: WebDAV list op Feb 13, 2023
@Xuanwo
Copy link
Member

Xuanwo commented Feb 13, 2023

@Xuanwo I have to go to sleep today. Will (probably) refine this PR tomorrow.

Wish you a beautiful night ❤️ ! Thank you so much!

@imWildCat
Copy link
Contributor Author

imWildCat commented Feb 18, 2023

Hi @Xuanwo, I spent most of today to debug this issue but haven't found a clue. May I have some hints on this?
Thanks in advance!

Some behavior tests always fail.

I'm not sure about its reason after I managed to attaching debugger to tests.
For example, services_webdav_list::test_check failed due to 404 not found, when I ran this test separately: cargo test --color=always --package opendal --test behavior services_webdav_list::test_check --features compress --no-fail-fast -- --format=json --exact -Z unstable-options --show-output

nginx_webdav_1  | [source IP] - - [18/Feb/2023:04:32:18 +0000] "PROPFIND /48403624-4f57-4ed6-b300-be94526aaebe/ HTTP/1.1" 404 162 "-" "-"

Environment variables:

export RUST_BACKTRACE=full
export RUST_LOG=debug
export OPENDAL_WEBDAV_TEST=on
export OPENDAL_WEBDAV_ENDPOINT=http://my_internal_ip_on_linux:port

@Xuanwo
Copy link
Member

Xuanwo commented Feb 18, 2023

Please always return Ok for dir. Take http service or s3 service as an example.

Sorry for the confusion, I will add it in docs.

@imWildCat
Copy link
Contributor Author

Please always return Ok for dir. Take http service or s3 service as an example.

Sorry for the confusion, I will add it in docs.

Thanks! This is super quick reply!

@imWildCat imWildCat changed the title [WIP] feat: WebDAV list op [WIP] feat: WebDAV ops: list and create (with MKCOL) Feb 18, 2023
@imWildCat imWildCat marked this pull request as ready for review February 18, 2023 21:55
@imWildCat imWildCat changed the title [WIP] feat: WebDAV ops: list and create (with MKCOL) eat: WebDAV ops: list and create (with MKCOL) Feb 18, 2023
@imWildCat imWildCat changed the title eat: WebDAV ops: list and create (with MKCOL) eat: WebDAV: add list and improve create (with MKCOL) Feb 18, 2023
@Xuanwo Xuanwo changed the title eat: WebDAV: add list and improve create (with MKCOL) feat: WebDAV: add list and improve create Feb 19, 2023
@Xuanwo Xuanwo changed the title feat: WebDAV: add list and improve create feat(webdav): add list and improve create Feb 19, 2023
@Xuanwo
Copy link
Member

Xuanwo commented Feb 19, 2023

Thank you so much for the effort you put into this feature! It's a lot more complex than I expected, but you've mastered them all. Good job!

@Xuanwo Xuanwo merged commit 9896845 into apache:main Feb 19, 2023
@imWildCat
Copy link
Contributor Author

Thank you, @Xuanwo !

I really appreciate the help from you and @ClSlaid !
I think this is the best way for me to learn Rust programming.

I will be using OpenDAL for WebDAV/GDrive/Dropbox/OneDrive in the future of client (not cloud) applications.
Happy to chat about its future!

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.

None yet

4 participants