Xuanwo commented on code in PR #5762:
URL: https://github.com/apache/opendal/pull/5762#discussion_r1994049512


##########
core/src/raw/ops.rs:
##########
@@ -44,6 +44,21 @@ impl OpCreateDir {
 #[derive(Debug, Clone, Default, Eq, Hash, PartialEq)]
 pub struct OpDelete {
     version: Option<String>,
+    /// The `recursive` is used to control whether the delete operation is 
recursive.
+    ///
+    /// if `false`, delete operation will only delete the given path.
+    /// if `true`, delete operation will delete all entries that starts with 
given path.
+    ///
+    /// Default to `false`.
+    recursive: bool,
+    /// The `versions` is used to control whether the object versions should 
be deleted.
+    ///
+    /// if `false`, delete operation will only delete the latest version.
+    /// if `true`, delete operation will delete all the object versions if 
object versioning is supported
+    /// by the underlying service.
+    ///
+    /// Default to `false`.
+    versions: bool,

Review Comment:
   We don't need to have versions here since users can delete versioned files 
in this way:
   
   ```rust
   let lister = op.lister_with(path).versions(ture).await?;
   let _ = op.delete_try_stream(lister).await?;
   ```
   



##########
core/src/types/operator/operator.rs:
##########


Review Comment:
   I'm thinking of implementing `recursive` support in layers (like what we do 
for `list_with_recursive`).
   
   We need to think of the following cases:
   
   - If the path itself is a dir:
     - If the service itself supports `delete_with_recursive`, we should 
forward the request directly to the service to save a significant amount of 
time spent listing files.
     - Otherwise, we need to simulate the list and delete logic.
   - If the path itself is not a dir:
     - We should try list it recursively and remove files.
     - But if the service suppprt `delete_with_recursive`, we can optimize into 
just list, and remove the dirs and files.
   
   So, the overall implementation is a bit complex (:



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to