Skip to content

Commit 37848eb

Browse files
committed
chore: bump opendal to 0.54
1 parent 19ef84c commit 37848eb

File tree

8 files changed

+72
-274
lines changed

8 files changed

+72
-274
lines changed

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ version = "0.4.2"
6767
path = "zarrs_object_store"
6868

6969
[workspace.dependencies.zarrs_opendal]
70-
version = "0.7.2"
70+
version = "0.8.0"
7171
path = "zarrs_opendal"
7272

7373
[workspace.dependencies.zarrs_zip]
@@ -78,7 +78,7 @@ path = "zarrs_zip"
7878
version = "0.12"
7979

8080
[workspace.dependencies.opendal]
81-
version = "0.53.0"
81+
version = "0.54.0"
8282

8383
[workspace.dependencies.zip]
8484
version = "3.0.0"

zarrs_opendal/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## Changed
11+
- **Breaking**: Bump `opendal` to 0.54
12+
13+
## Removed
14+
- **Breaking**: Remove `OpendalStore`
15+
- Use `AsyncOpendalStore` with the `AsyncToSyncStorageAdapter` instead
16+
1017
## [0.7.2] - 2025-05-16
1118

1219
## Changed

zarrs_opendal/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "zarrs_opendal"
3-
version = "0.7.2"
3+
version = "0.8.0"
44
authors = ["Lachlan Deakin <[email protected]>"]
55
edition = "2021"
66
rust-version = "1.80"
@@ -18,7 +18,7 @@ workspace = true
1818
[dependencies]
1919
async-trait = "0.1.74"
2020
futures = "0.3.29"
21-
opendal = { version = ">=0.51,<0.54", default-features = false }
21+
opendal = { version = ">=0.54,<0.55", default-features = false, features=["blocking"] }
2222
zarrs_storage = { workspace = true, features = ["async"] }
2323

2424
[dev-dependencies]

zarrs_opendal/doc/version_compatibility_matrix.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
| [zarrs_opendal] | [opendal] | [zarrs] ([zarrs_storage]) |
22
| --------------- | --------- | ------------------------- |
3+
| 0.8 | 0.54-0.54 | 0.18+ (0.3.x) |
34
| 0.7 | 0.51-0.53 | 0.18+ (0.3.x) |
45
| 0.6 | 0.51-0.52 | 0.18+ (0.3.x) |
56
| 0.5 | 0.51-0.51 | 0.18+ (0.3.x) |

zarrs_opendal/src/async.rs

Lines changed: 30 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
use futures::stream::TryStreamExt;
2+
use futures::{future, StreamExt};
13
use opendal::Operator;
24

35
use zarrs_storage::{
@@ -12,13 +14,24 @@ use crate::{handle_result, handle_result_notfound};
1214
/// An asynchronous store backed by an [`opendal::Operator`].
1315
pub struct AsyncOpendalStore {
1416
operator: Operator,
17+
concurrent_stat_requests: usize,
1518
}
1619

1720
impl AsyncOpendalStore {
1821
/// Create a new [`AsyncOpendalStore`].
1922
#[must_use]
2023
pub fn new(operator: Operator) -> Self {
21-
Self { operator }
24+
Self {
25+
operator,
26+
concurrent_stat_requests: 32,
27+
}
28+
}
29+
30+
/// Set the number of concurrent stat requests.
31+
#[must_use]
32+
pub fn with_concurrent_stat_requests(mut self, concurrent_stat_requests: usize) -> Self {
33+
self.concurrent_stat_requests = concurrent_stat_requests;
34+
self
2235
}
2336
}
2437

@@ -157,43 +170,24 @@ impl AsyncListableStorageTraits for AsyncOpendalStore {
157170
}
158171

159172
async fn size_prefix(&self, prefix: &StorePrefix) -> Result<u64, StorageError> {
160-
let Some(files) = handle_result_notfound(
173+
let lister = handle_result(
161174
self.operator
162-
.list_with(prefix.as_str())
175+
.lister_with(prefix.as_str())
163176
.recursive(true)
164177
.await,
165-
)?
166-
else {
167-
return Ok(0);
168-
};
169-
170-
if self
171-
.operator
172-
.info()
173-
.full_capability()
174-
.list_has_content_length
175-
{
176-
let size = files
177-
.into_iter()
178-
.filter_map(|entry| {
179-
if entry.metadata().is_file() {
180-
Some(entry.metadata().content_length())
181-
} else {
182-
None
183-
}
184-
})
185-
.sum::<u64>();
186-
Ok(size)
187-
} else {
188-
// TODO: concurrent
189-
let mut size = 0;
190-
for entry in files {
191-
let meta = handle_result(self.operator.stat(entry.path()).await)?;
192-
if meta.is_file() {
193-
size += meta.content_length();
194-
}
195-
}
196-
Ok(size)
197-
}
178+
)?;
179+
180+
let total_size = lister
181+
.try_filter(|entry| future::ready(entry.metadata().mode().is_file()))
182+
.map(move |entry_result| async move {
183+
let entry = handle_result(entry_result)?;
184+
let metadata = handle_result(self.operator.stat(entry.path()).await)?;
185+
Ok::<_, StorageError>(metadata.content_length())
186+
})
187+
.buffer_unordered(self.concurrent_stat_requests)
188+
.try_fold(0, |acc, size| future::ready(Ok(acc + size)))
189+
.await?;
190+
191+
Ok(total_size)
198192
}
199193
}

zarrs_opendal/src/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,8 @@
3131
//! - the MIT license [LICENSE-MIT](https://docs.rs/crate/zarrs_opendal/latest/source/LICENCE-MIT) or <http://opensource.org/licenses/MIT>, at your option.
3232
3333
mod r#async;
34-
mod sync;
3534

3635
pub use r#async::AsyncOpendalStore;
37-
pub use sync::OpendalStore;
3836

3937
pub use opendal;
4038

zarrs_opendal/src/sync.rs

Lines changed: 0 additions & 220 deletions
This file was deleted.

0 commit comments

Comments
 (0)