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


##########
core/core/src/types/capability.rs:
##########
@@ -118,8 +118,16 @@ pub struct Capability {
     /// Indicates if Cache-Control can be specified during write operations.
     pub write_with_cache_control: bool,
     /// Indicates if conditional write operations using If-Match are supported.
+    ///
+    /// The value passed to `if_match` is normally a literal ETag. GCS is an 
exception:

Review Comment:
   No, we don't do this. It's very clear that `if-match` accepts an etag. 
   
   ---
   
   Think about this, we now have a user want to support all of s3, azblob and 
gcs.
   
   The user is using APIs like:
   
   ```rust
   let expected_etag = op.stat(pathx).await?.etag();
   let _ = op.write_with(pathx, data).if_match(expected_etag).await?;
   ```
   
   Then this user will go crazy to find that it doesn't work, because 
`if_match` always didn't match. After reading docs, he realized that he need to 
do:
   
   ```rust
   let expected_etag = if op.scheme() == "gcs" {
       op.stat(pathx).await?.version()
   } else {
       op.stat(pathx).await?.etag()
   };
   
   let _ = op.write_with(pathx, data).if_match(expected_etag).await?;
   ```
   
   I don't think he will love opendal again.



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