From 5423bc073302d8ce8b5b82250ccd6221a4e55d6a Mon Sep 17 00:00:00 2001 From: Lachlan Deakin Date: Wed, 17 Jan 2024 11:50:34 +1100 Subject: [PATCH] Bump `object_store` to 0.9 --- CHANGELOG.md | 1 + Cargo.toml | 2 +- src/storage/store/store_async/object_store.rs | 14 +++++++++++++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 315eef51..357f1864 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Bump `opendal` to 0.44 + - Bump `object_store` to 0.9 - **Breaking** `async_store_chunk` and `AsyncWritableStorageTraits::set` now take `bytes::Bytes` - `bytes::Bytes` are used by both supported async stores (`object_store` and `opendal`), and this avoids a copy diff --git a/Cargo.toml b/Cargo.toml index 537db1c0..8fd86691 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -52,7 +52,7 @@ inventory = "0.3" itertools = "0.12" ndarray = { version = "0.15", optional = true } num = { version = "0.4" } -object_store = { version = "0.8.0", optional = true } +object_store = { version = "0.9.0", optional = true } opendal = { version = "0.44", optional = true } parking_lot = "0.12" pathdiff = "0.2" diff --git a/src/storage/store/store_async/object_store.rs b/src/storage/store/store_async/object_store.rs index 1d7d0b71..aa8da175 100644 --- a/src/storage/store/store_async/object_store.rs +++ b/src/storage/store/store_async/object_store.rs @@ -92,7 +92,19 @@ impl AsyncReadableStorageTraits for AsyncObjectSto .await; match get_ranges { Ok(get_ranges) => Ok(Some( - get_ranges.iter().map(|bytes| bytes.to_vec()).collect(), + std::iter::zip(ranges, get_ranges) + .map(|(range, bytes)| { + if range.len() == bytes.len() { + Ok(bytes.to_vec()) + } else { + Err(StorageError::Other(format!( + "Unexpected length of bytes returned, expected {}, got {}", + range.len(), + bytes.len() + ))) + } + }) + .collect::>()?, )), Err(err) => { if matches!(err, object_store::Error::NotFound { .. }) {