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 0cd81709c feat(services/swift): Implement write returns metadata
(#6669)
0cd81709c is described below
commit 0cd81709c9a0caa9f3d4d2990e03e26b49f6019f
Author: Yunchi Pang <[email protected]>
AuthorDate: Tue Oct 14 10:45:59 2025 -0700
feat(services/swift): Implement write returns metadata (#6669)
* feat(services/swift): Implement write returns metadata
* remove Content-Type extraction
---
core/src/services/swift/writer.rs | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/core/src/services/swift/writer.rs
b/core/src/services/swift/writer.rs
index c3f7ac44e..2ff104163 100644
--- a/core/src/services/swift/writer.rs
+++ b/core/src/services/swift/writer.rs
@@ -34,6 +34,20 @@ impl SwiftWriter {
pub fn new(core: Arc<SwiftCore>, op: OpWrite, path: String) -> Self {
SwiftWriter { core, op, path }
}
+
+ fn parse_metadata(headers: &http::HeaderMap) -> Result<Metadata> {
+ let mut metadata = Metadata::default();
+
+ if let Some(etag) = parse_etag(headers)? {
+ metadata.set_etag(etag);
+ }
+
+ if let Some(last_modified) = parse_last_modified(headers)? {
+ metadata.set_last_modified(last_modified);
+ }
+
+ Ok(metadata)
+ }
}
impl oio::OneShotWrite for SwiftWriter {
@@ -46,7 +60,10 @@ impl oio::OneShotWrite for SwiftWriter {
let status = resp.status();
match status {
- StatusCode::CREATED | StatusCode::OK => Ok(Metadata::default()),
+ StatusCode::CREATED | StatusCode::OK => {
+ let metadata = SwiftWriter::parse_metadata(resp.headers())?;
+ Ok(metadata)
+ }
_ => Err(parse_error(resp)),
}
}