Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Polish the implement of Query Based Metadata Cache #1400

Merged
merged 6 commits into from
Feb 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion binaries/oay/src/services/http/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ impl Service {
}

async fn put(&self, req: HttpRequest, mut body: web::Payload) -> Result<HttpResponse> {
let mut o = self
let o = self
.op
.object(&percent_decode(req.path().as_bytes()).decode_utf8_lossy());

Expand Down
2 changes: 1 addition & 1 deletion binaries/oli/src/commands/cp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub async fn main(args: Option<ArgMatches>) -> Result<()> {
.get_one::<String>("destination")
.ok_or_else(|| anyhow!("missing target"))?;
let (dst_op, dst_path) = parse_location(dst)?;
let mut dst_o = dst_op.object(dst_path);
let dst_o = dst_op.object(dst_path);

let size = src_o.stat().await?.content_length();
let reader = src_o.reader().await?;
Expand Down
4 changes: 2 additions & 2 deletions bindings/object_store/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ impl std::fmt::Display for OpendalStore {
#[async_trait]
impl ObjectStore for OpendalStore {
async fn put(&self, location: &Path, bytes: Bytes) -> Result<()> {
let mut o = self.inner.object(location.as_ref());
let o = self.inner.object(location.as_ref());
Ok(o.write(bytes)
.await
.map_err(|err| format_object_store_error(err, location.as_ref()))?)
Expand Down Expand Up @@ -127,7 +127,7 @@ impl ObjectStore for OpendalStore {
}

async fn delete(&self, location: &Path) -> Result<()> {
let mut o = self.inner.object(location.as_ref());
let o = self.inner.object(location.as_ref());
o.delete()
.await
.map_err(|err| format_object_store_error(err, location.as_ref()))?;
Expand Down
4 changes: 2 additions & 2 deletions src/layers/complete.rs
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ impl<A: Accessor> LayeredAccessor for CompleteReaderAccessor<A> {
self.inner.stat(path, args).await.map(|v| {
v.map_metadata(|m| {
let bit = m.bit();
m.with_bit(bit | ObjectMetadataKey::Complete)
m.with_bit(bit | ObjectMetakey::Complete)
})
})
}
Expand All @@ -304,7 +304,7 @@ impl<A: Accessor> LayeredAccessor for CompleteReaderAccessor<A> {
self.inner.blocking_stat(path, args).map(|v| {
v.map_metadata(|m| {
let bit = m.bit();
m.with_bit(bit | ObjectMetadataKey::Complete)
m.with_bit(bit | ObjectMetakey::Complete)
})
})
}
Expand Down
20 changes: 10 additions & 10 deletions src/layers/immutable_index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ mod tests {
let mut map = HashMap::new();
let mut set = HashSet::new();
let mut ds = op.object("").list().await?;
while let Some(mut entry) = ds.try_next().await? {
while let Some(entry) = ds.try_next().await? {
debug!("got entry: {}", entry.path());
assert!(
set.insert(entry.path().to_string()),
Expand All @@ -298,7 +298,7 @@ mod tests {
);
map.insert(
entry.path().to_string(),
entry.metadata(ObjectMetadataKey::Mode).await?.mode(),
entry.metadata(ObjectMetakey::Mode).await?.mode(),
);
}

Expand Down Expand Up @@ -327,7 +327,7 @@ mod tests {
let mut ds = op.object("/").scan().await?;
let mut set = HashSet::new();
let mut map = HashMap::new();
while let Some(mut entry) = ds.try_next().await? {
while let Some(entry) = ds.try_next().await? {
debug!("got entry: {}", entry.path());
assert!(
set.insert(entry.path().to_string()),
Expand All @@ -336,7 +336,7 @@ mod tests {
);
map.insert(
entry.path().to_string(),
entry.metadata(ObjectMetadataKey::Mode).await?.mode(),
entry.metadata(ObjectMetakey::Mode).await?.mode(),
);
}

Expand Down Expand Up @@ -372,15 +372,15 @@ mod tests {
let mut map = HashMap::new();
let mut set = HashSet::new();
let mut ds = op.object("/").list().await?;
while let Some(mut entry) = ds.try_next().await? {
while let Some(entry) = ds.try_next().await? {
assert!(
set.insert(entry.path().to_string()),
"duplicated value: {}",
entry.path()
);
map.insert(
entry.path().to_string(),
entry.metadata(ObjectMetadataKey::Mode).await?.mode(),
entry.metadata(ObjectMetakey::Mode).await?.mode(),
);
}

Expand All @@ -391,15 +391,15 @@ mod tests {
let mut map = HashMap::new();
let mut set = HashSet::new();
let mut ds = op.object("dataset/stateful/").list().await?;
while let Some(mut entry) = ds.try_next().await? {
while let Some(entry) = ds.try_next().await? {
assert!(
set.insert(entry.path().to_string()),
"duplicated value: {}",
entry.path()
);
map.insert(
entry.path().to_string(),
entry.metadata(ObjectMetadataKey::Mode).await?.mode(),
entry.metadata(ObjectMetakey::Mode).await?.mode(),
);
}

Expand Down Expand Up @@ -442,15 +442,15 @@ mod tests {

let mut map = HashMap::new();
let mut set = HashSet::new();
while let Some(mut entry) = ds.try_next().await? {
while let Some(entry) = ds.try_next().await? {
assert!(
set.insert(entry.path().to_string()),
"duplicated value: {}",
entry.path()
);
map.insert(
entry.path().to_string(),
entry.metadata(ObjectMetadataKey::Mode).await?.mode(),
entry.metadata(ObjectMetakey::Mode).await?.mode(),
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ mod object;
pub use object::Object;
pub use object::ObjectLister;
pub use object::ObjectMetadata;
pub use object::ObjectMetadataKey;
pub use object::ObjectMetakey;
pub use object::ObjectMode;
pub use object::ObjectMultipart;
pub use object::ObjectPart;
Expand Down
Loading