From 2d9b0e48666f334bd386ce6c5c76df666ca448fc Mon Sep 17 00:00:00 2001 From: Xuanwo Date: Tue, 2 Jul 2024 00:07:24 +0800 Subject: [PATCH 1/2] fix(integration/object_store): Fix metakey requested is incomplete Signed-off-by: Xuanwo --- integrations/object_store/Cargo.toml | 1 + integrations/object_store/src/store.rs | 20 ++++++++++++++++---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/integrations/object_store/Cargo.toml b/integrations/object_store/Cargo.toml index dcccf2b43ef8..e7065e14ca49 100644 --- a/integrations/object_store/Cargo.toml +++ b/integrations/object_store/Cargo.toml @@ -40,6 +40,7 @@ opendal = { version = "0.47.0", path = "../../core" } pin-project = "1.1" send_wrapper = { version = "0.6", features = ["futures"], optional = true } tokio = { version = "1", default-features = false } +flagset = "0.4" [dev-dependencies] opendal = { version = "0.47.0", path = "../../core", features = [ diff --git a/integrations/object_store/src/store.rs b/integrations/object_store/src/store.rs index cbfc1b984530..d2918f93270b 100644 --- a/integrations/object_store/src/store.rs +++ b/integrations/object_store/src/store.rs @@ -101,6 +101,16 @@ impl OpendalStore { pub fn new(op: Operator) -> Self { Self { inner: op } } + + /// The metakey that requested by object_store, should align with it's meta. + #[inline] + fn metakey() -> flagset::FlagSet { + Metakey::Mode + | Metakey::LastModified + | Metakey::ContentLength + | Metakey::Etag + | Metakey::Version + } } impl Debug for OpendalStore { @@ -293,7 +303,7 @@ impl ObjectStore for OpendalStore { let stream = self .inner .lister_with(&path) - .metakey(Metakey::ContentLength | Metakey::LastModified) + .metakey(Self::metakey()) .recursive(true) .await .map_err(|err| format_object_store_error(err, &path))?; @@ -323,7 +333,7 @@ impl ObjectStore for OpendalStore { self.inner .lister_with(&path) .start_after(offset.as_ref()) - .metakey(Metakey::ContentLength | Metakey::LastModified) + .metakey(Self::metakey()) .recursive(true) .into_future() .into_send() @@ -335,7 +345,7 @@ impl ObjectStore for OpendalStore { } else { self.inner .lister_with(&path) - .metakey(Metakey::ContentLength | Metakey::LastModified) + .metakey(Self::metakey()) .recursive(true) .into_future() .into_send() @@ -357,7 +367,9 @@ impl ObjectStore for OpendalStore { let mut stream = self .inner .lister_with(&path) - .metakey(Metakey::Mode | Metakey::ContentLength | Metakey::LastModified) + .metakey( + Metakey::Mode | Metakey::ContentLength | Metakey::LastModified | Metakey::Version, + ) .into_future() .into_send() .await From 591c383410330f8dd7654635ad2487b4663b9a64 Mon Sep 17 00:00:00 2001 From: Xuanwo Date: Tue, 2 Jul 2024 18:52:30 +0800 Subject: [PATCH 2/2] Address comments Signed-off-by: Xuanwo --- integrations/object_store/src/store.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/integrations/object_store/src/store.rs b/integrations/object_store/src/store.rs index d2918f93270b..84029646c50e 100644 --- a/integrations/object_store/src/store.rs +++ b/integrations/object_store/src/store.rs @@ -102,7 +102,7 @@ impl OpendalStore { Self { inner: op } } - /// The metakey that requested by object_store, should align with it's meta. + /// The metakey that requested by object_store, should align with its meta. #[inline] fn metakey() -> flagset::FlagSet { Metakey::Mode @@ -367,9 +367,7 @@ impl ObjectStore for OpendalStore { let mut stream = self .inner .lister_with(&path) - .metakey( - Metakey::Mode | Metakey::ContentLength | Metakey::LastModified | Metakey::Version, - ) + .metakey(Self::metakey()) .into_future() .into_send() .await