You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by xu...@apache.org on 2024/11/14 09:39:16 UTC
(opendal) 04/06: Add azdls
This is an automated email from the ASF dual-hosted git repository.
xuanwo pushed a commit to branch add-write-if-not-exists
in repository https://gitbox.apache.org/repos/asf/opendal.git
commit 640dfba79308f7d128fc3932ebe96bb48b4885bc
Author: Xuanwo <gi...@xuanwo.io>
AuthorDate: Thu Nov 14 17:28:56 2024 +0800
Add azdls
Signed-off-by: Xuanwo <gi...@xuanwo.io>
---
core/src/services/azdls/backend.rs | 3 +++
core/src/services/azdls/core.rs | 10 +++++++++-
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/core/src/services/azdls/backend.rs b/core/src/services/azdls/backend.rs
index 34d7125d6..534c7c190 100644
--- a/core/src/services/azdls/backend.rs
+++ b/core/src/services/azdls/backend.rs
@@ -233,6 +233,9 @@ impl Access for AzdlsBackend {
write: true,
write_can_append: true,
+ write_with_if_none_match: true,
+ write_with_if_not_exists: true,
+
create_dir: true,
delete: true,
rename: true,
diff --git a/core/src/services/azdls/core.rs b/core/src/services/azdls/core.rs
index 714a5adc7..90d9f5533 100644
--- a/core/src/services/azdls/core.rs
+++ b/core/src/services/azdls/core.rs
@@ -20,9 +20,9 @@ use std::fmt::Debug;
use std::fmt::Formatter;
use std::fmt::Write;
-use http::header::CONTENT_DISPOSITION;
use http::header::CONTENT_LENGTH;
use http::header::CONTENT_TYPE;
+use http::header::{CONTENT_DISPOSITION, IF_NONE_MATCH};
use http::HeaderName;
use http::HeaderValue;
use http::Request;
@@ -153,6 +153,14 @@ impl AzdlsCore {
req = req.header(CONTENT_DISPOSITION, pos)
}
+ if args.if_not_exists() {
+ req = req.header(IF_NONE_MATCH, "*")
+ }
+
+ if let Some(v) = args.if_none_match() {
+ req = req.header(IF_NONE_MATCH, v)
+ }
+
// Set body
let req = req.body(body).map_err(new_request_build_error)?;