Skip to content
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 Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "object_store_ffi"
version = "0.12.1"
version = "0.12.2"
edition = "2021"

[[bench]]
Expand Down
14 changes: 7 additions & 7 deletions src/crud_ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,19 +228,19 @@ impl Client {
with_retries!(self, self.delete_impl(path).await)
}

async fn bulk_delete_impl(&self, paths: &Vec<Path>) -> crate::Result<Vec<(Path, crate::Error)>> {
async fn bulk_delete_impl(&self, og_paths: &Vec<Path>) -> crate::Result<Vec<(Path, crate::Error)>> {
// Add the client prefix to the provided paths if needed
let paths = paths.into_iter().map(|path| self.full_path(path)).collect::<Vec<Path>>();
let stream = stream::iter(paths.iter().map(|path| Ok(path.clone()))).boxed();
let prefixed_paths = og_paths.into_iter().map(|path| self.full_path(path)).collect::<Vec<Path>>();
let stream = stream::iter(prefixed_paths.iter().map(|path| Ok(path.clone()))).boxed();
let results = self.store.delete_stream(stream)
.collect::<Vec<_>>().await;
// We count the number of results to raise an error if some paths were not
// successfully processed at all.
let num_results = results.len();
let failures = results
.into_iter()
.enumerate()
.filter_map(|(index, result)| {
.zip(og_paths.into_iter()) // Stops at the shorter iterator
.filter_map(|(result, og_path)| {
match result {
Ok(_) => {
None
Expand All @@ -252,14 +252,14 @@ impl Client {
None
},
_ => {
Some((paths[index].clone(), e.into()))
Some((og_path.clone(), e.into()))
}
},
}
}).collect::<Vec<(Path, crate::Error)>>();

// Rail guard to catch generic errors
if num_results < paths.len() {
if num_results < og_paths.len() {
if num_results == 0 {
tracing::warn!("delete_stream returned zero results");
Err(crate::Error::invalid_response("Some paths were not deleted"))
Expand Down