You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by "Young-Flash (via GitHub)" <gi...@apache.org> on 2023/08/03 15:07:58 UTC

[GitHub] [incubator-opendal] Young-Flash opened a new pull request, #2769: feat(oay): add write for oay webdav

Young-Flash opened a new pull request, #2769:
URL: https://github.com/apache/incubator-opendal/pull/2769

   https://github.com/apache/incubator-opendal/issues/2586


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


[GitHub] [incubator-opendal] Xuanwo commented on a diff in pull request #2769: feat(oay): add write for oay webdav

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


##########
bin/oay/src/services/webdav/webdav_file.rs:
##########
@@ -62,18 +62,35 @@ impl DavFile for WebdavFile {
     }
 
     fn write_buf(&mut self, _buf: Box<dyn bytes::Buf + Send>) -> FsFuture<()> {
-        todo!()
+        self.write_bytes(bytes::Bytes::copy_from_slice(_buf.chunk()))
     }
 
-    fn write_bytes(&mut self, _buf: bytes::Bytes) -> FsFuture<()> {
-        todo!()
+    fn write_bytes(&mut self, buf: bytes::Bytes) -> FsFuture<()> {
+        async move {
+            let file_path = self.path.as_url_string();
+            self.op
+                .write(&file_path, buf)
+                .await
+                .map_err(|e| convert_error(e))
+        }
+        .boxed()
     }
 
     fn seek(&mut self, _pos: SeekFrom) -> FsFuture<u64> {
-        todo!()
+        futures_util::future::ok(0).boxed()

Review Comment:
   No, we should return unsupported.



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


[GitHub] [incubator-opendal] Young-Flash commented on a diff in pull request #2769: feat(oay): add write for oay webdav

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


##########
bin/oay/src/services/webdav/webdav_file.rs:
##########
@@ -62,18 +62,35 @@ impl DavFile for WebdavFile {
     }
 
     fn write_buf(&mut self, _buf: Box<dyn bytes::Buf + Send>) -> FsFuture<()> {
-        todo!()
+        self.write_bytes(bytes::Bytes::copy_from_slice(_buf.chunk()))
     }
 
-    fn write_bytes(&mut self, _buf: bytes::Bytes) -> FsFuture<()> {
-        todo!()
+    fn write_bytes(&mut self, buf: bytes::Bytes) -> FsFuture<()> {
+        async move {
+            let file_path = self.path.as_url_string();
+            self.op
+                .write(&file_path, buf)
+                .await
+                .map_err(|e| convert_error(e))
+        }
+        .boxed()
     }
 
     fn seek(&mut self, _pos: SeekFrom) -> FsFuture<u64> {
-        todo!()
+        futures_util::future::ok(0).boxed()

Review Comment:
   is it ok to return 0 here ?



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


[GitHub] [incubator-opendal] Xuanwo commented on a diff in pull request #2769: feat(oay): add write for oay webdav

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


##########
bin/oay/src/services/webdav/webdav_file.rs:
##########
@@ -62,18 +62,32 @@ impl DavFile for WebdavFile {
     }
 
     fn write_buf(&mut self, _buf: Box<dyn bytes::Buf + Send>) -> FsFuture<()> {
-        todo!()
+        self.write_bytes(bytes::Bytes::copy_from_slice(_buf.chunk()))
     }
 
-    fn write_bytes(&mut self, _buf: bytes::Bytes) -> FsFuture<()> {
-        todo!()
+    fn write_bytes(&mut self, buf: bytes::Bytes) -> FsFuture<()> {

Review Comment:
   I prefer to `use bytes::Bytes` so that we don't need to repeat here.



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


[GitHub] [incubator-opendal] suyanhanx commented on a diff in pull request #2769: feat(oay): add write for oay webdav

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


##########
bin/oay/src/services/webdav/webdav_file.rs:
##########
@@ -62,18 +62,32 @@ impl DavFile for WebdavFile {
     }
 
     fn write_buf(&mut self, _buf: Box<dyn bytes::Buf + Send>) -> FsFuture<()> {
-        todo!()
+        self.write_bytes(bytes::Bytes::copy_from_slice(_buf.chunk()))

Review Comment:
   As a variable in use, its name should not start with `_`.



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


[GitHub] [incubator-opendal] oowl merged pull request #2769: feat(oay): add write for oay webdav

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


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


[GitHub] [incubator-opendal] Xuanwo commented on a diff in pull request #2769: feat(oay): add write for oay webdav

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


##########
bin/oay/src/services/webdav/webdav_file.rs:
##########
@@ -62,18 +62,32 @@ impl DavFile for WebdavFile {
     }
 
     fn write_buf(&mut self, _buf: Box<dyn bytes::Buf + Send>) -> FsFuture<()> {
-        todo!()
+        self.write_bytes(bytes::Bytes::copy_from_slice(_buf.chunk()))
     }
 
-    fn write_bytes(&mut self, _buf: bytes::Bytes) -> FsFuture<()> {
-        todo!()
+    fn write_bytes(&mut self, buf: bytes::Bytes) -> FsFuture<()> {

Review Comment:
   I prefer to `use bytes::Byter` so that we don't need to repeat here.



##########
bin/oay/src/services/webdav/webdav_file.rs:
##########
@@ -62,18 +62,32 @@ impl DavFile for WebdavFile {
     }
 
     fn write_buf(&mut self, _buf: Box<dyn bytes::Buf + Send>) -> FsFuture<()> {
-        todo!()
+        self.write_bytes(bytes::Bytes::copy_from_slice(_buf.chunk()))

Review Comment:
   It's better to rename `_buf` to `buf` for better reading.



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