Skip to content

Commit

Permalink
fix(integration/object_store): Fix metakey requested is incomplete (#…
Browse files Browse the repository at this point in the history
…4844)

* fix(integration/object_store): Fix metakey requested is incomplete

Signed-off-by: Xuanwo <github@xuanwo.io>

* Address comments

Signed-off-by: Xuanwo <github@xuanwo.io>

---------

Signed-off-by: Xuanwo <github@xuanwo.io>
  • Loading branch information
Xuanwo authored Jul 2, 2024
1 parent e58e616 commit c9c2bb2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
1 change: 1 addition & 0 deletions integrations/object_store/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
18 changes: 14 additions & 4 deletions integrations/object_store/src/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,16 @@ impl OpendalStore {
inner: op,
}
}

/// The metakey that requested by object_store, should align with its meta.
#[inline]
fn metakey() -> flagset::FlagSet<Metakey> {
Metakey::Mode
| Metakey::LastModified
| Metakey::ContentLength
| Metakey::Etag
| Metakey::Version
}
}

impl Debug for OpendalStore {
Expand Down Expand Up @@ -296,7 +306,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))?;
Expand Down Expand Up @@ -326,7 +336,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()
Expand All @@ -338,7 +348,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()
Expand All @@ -360,7 +370,7 @@ impl ObjectStore for OpendalStore {
let mut stream = self
.inner
.lister_with(&path)
.metakey(Metakey::Mode | Metakey::ContentLength | Metakey::LastModified)
.metakey(Self::metakey())
.into_future()
.into_send()
.await
Expand Down

0 comments on commit c9c2bb2

Please sign in to comment.