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 f13270251 feat(services/gdrive): Add operation in http context (#6068)
f13270251 is described below
commit f1327025174e0968e939fbef20a26b0db8eb8d74
Author: Jorge Hermo <[email protected]>
AuthorDate: Sun Apr 27 16:00:37 2025 +0200
feat(services/gdrive): Add operation in http context (#6068)
* feat(services/gdrive): Add operation in http context
* chore: trigger CI again
---
core/src/services/gdrive/core.rs | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/core/src/services/gdrive/core.rs b/core/src/services/gdrive/core.rs
index c24e14105..2f9405ad4 100644
--- a/core/src/services/gdrive/core.rs
+++ b/core/src/services/gdrive/core.rs
@@ -69,6 +69,7 @@ impl GdriveCore {
"https://www.googleapis.com/drive/v3/files/{}?fields=id,name,mimeType,size,modifiedTime",
file_id
))
+ .extension(Operation::Stat)
.body(Buffer::new())
.map_err(new_request_build_error)?;
self.sign(&mut req).await?;
@@ -89,6 +90,7 @@ impl GdriveCore {
);
let mut req = Request::get(&url)
+ .extension(Operation::Read)
.header(header::RANGE, range.to_header())
.body(Buffer::new())
.map_err(new_request_build_error)?;
@@ -113,6 +115,7 @@ impl GdriveCore {
};
let mut req = Request::get(url.finish())
+ .extension(Operation::List)
.body(Buffer::new())
.map_err(new_request_build_error)?;
self.sign(&mut req).await?;
@@ -151,6 +154,7 @@ impl GdriveCore {
source_file_id
);
let mut req = Request::patch(url)
+ .extension(Operation::Rename)
.body(Buffer::from(Bytes::from(metadata.to_string())))
.map_err(new_request_build_error)?;
@@ -168,6 +172,7 @@ impl GdriveCore {
.map_err(new_json_serialize_error)?;
let mut req = Request::patch(&url)
+ .extension(Operation::Delete)
.body(Buffer::from(Bytes::from(body)))
.map_err(new_request_build_error)?;
@@ -195,7 +200,9 @@ impl GdriveCore {
}))
.map_err(new_json_serialize_error)?;
- let req = Request::post(url).header("X-Upload-Content-Length", size);
+ let req = Request::post(url)
+ .header("X-Upload-Content-Length", size)
+ .extension(Operation::Write);
let multipart = Multipart::new()
.part(
@@ -242,6 +249,7 @@ impl GdriveCore {
.header(header::CONTENT_TYPE, "application/octet-stream")
.header(header::CONTENT_LENGTH, size)
.header("X-Upload-Content-Length", size)
+ .extension(Operation::Write)
.body(body)
.map_err(new_request_build_error)?;
@@ -290,6 +298,7 @@ impl GdriveCore {
let body = Buffer::from(Bytes::from(request_body.to_string()));
let mut req = Request::post(&url)
+ .extension(Operation::Copy)
.body(body)
.map_err(new_request_build_error)?;
self.sign(&mut req).await?;
@@ -413,6 +422,7 @@ impl PathQuery for GdrivePathQuery {
);
let mut req = Request::get(&url)
+ .extension(Operation::Stat)
.body(Buffer::new())
.map_err(new_request_build_error)?;
@@ -449,6 +459,7 @@ impl PathQuery for GdrivePathQuery {
.map_err(new_json_serialize_error)?;
let mut req = Request::post(url)
+ .extension(Operation::CreateDir)
.header(header::CONTENT_TYPE, "application/json")
.body(Buffer::from(Bytes::from(content)))
.map_err(new_request_build_error)?;