This is an automated email from the ASF dual-hosted git repository.

xuanwo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/opendal.git


The following commit(s) were added to refs/heads/main by this push:
     new 299aa142a feat(services/swift): Add operation in http context (#6106)
299aa142a is described below

commit 299aa142acdaa0d5b4cd0bc1cbd98fab363db0e0
Author: Jorge Hermo <[email protected]>
AuthorDate: Sun Apr 27 15:57:21 2025 +0200

    feat(services/swift): Add operation in http context (#6106)
---
 core/src/services/swift/core.rs | 30 ++++++++++++++++++++++++------
 1 file changed, 24 insertions(+), 6 deletions(-)

diff --git a/core/src/services/swift/core.rs b/core/src/services/swift/core.rs
index 39b322ae5..4c8c0e9ef 100644
--- a/core/src/services/swift/core.rs
+++ b/core/src/services/swift/core.rs
@@ -60,7 +60,10 @@ impl SwiftCore {
 
         let body = Buffer::new();
 
-        let req = req.body(body).map_err(new_request_build_error)?;
+        let req = req
+            .extension(Operation::Delete)
+            .body(body)
+            .map_err(new_request_build_error)?;
 
         self.info.http_client().send(req).await
     }
@@ -92,7 +95,10 @@ impl SwiftCore {
 
         req = req.header("X-Auth-Token", &self.token);
 
-        let req = req.body(Buffer::new()).map_err(new_request_build_error)?;
+        let req = req
+            .extension(Operation::List)
+            .body(Buffer::new())
+            .map_err(new_request_build_error)?;
 
         self.info.http_client().send(req).await
     }
@@ -124,7 +130,10 @@ impl SwiftCore {
         req = req.header("X-Auth-Token", &self.token);
         req = req.header(header::CONTENT_LENGTH, length);
 
-        let req = req.body(body).map_err(new_request_build_error)?;
+        let req = req
+            .extension(Operation::Write)
+            .body(body)
+            .map_err(new_request_build_error)?;
 
         self.info.http_client().send(req).await
     }
@@ -154,7 +163,10 @@ impl SwiftCore {
             req = req.header(header::RANGE, range.to_header());
         }
 
-        let req = req.body(Buffer::new()).map_err(new_request_build_error)?;
+        let req = req
+            .extension(Operation::Read)
+            .body(Buffer::new())
+            .map_err(new_request_build_error)?;
 
         self.info.http_client().fetch(req).await
     }
@@ -191,7 +203,10 @@ impl SwiftCore {
 
         let body = Buffer::new();
 
-        let req = req.body(body).map_err(new_request_build_error)?;
+        let req = req
+            .extension(Operation::Copy)
+            .body(body)
+            .map_err(new_request_build_error)?;
 
         self.info.http_client().send(req).await
     }
@@ -210,7 +225,10 @@ impl SwiftCore {
 
         req = req.header("X-Auth-Token", &self.token);
 
-        let req = req.body(Buffer::new()).map_err(new_request_build_error)?;
+        let req = req
+            .extension(Operation::Stat)
+            .body(Buffer::new())
+            .map_err(new_request_build_error)?;
 
         self.info.http_client().send(req).await
     }

Reply via email to