Skip to content

Commit ae9e4d7

Browse files
peaseesgrebnov
authored andcommitted
Extend file metadata
Combined change from two PRs - #13 - #15
1 parent e7a49a6 commit ae9e4d7

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ Apache Iceberg is an active open-source project, governed under the Apache Softw
9191
at [Slack #rust channel](https://join.slack.com/t/apache-iceberg/shared_invite/zt-1zbov3k6e-KtJfoaxp97YfX6dPz1Bk7A).
9292

9393
The Apache Iceberg community is built on the principles described in the [Apache Way](https://www.apache.org/theapacheway/index.html) and all who engage with the community are expected to be respectful, open, come with the best interests of the community in mind, and abide by the Apache Foundation [Code of Conduct](https://www.apache.org/foundation/policies/conduct.html).
94+
9495
## Users
9596

9697
- [Databend](https://github.com/datafuselabs/databend/): An open-source cloud data warehouse that serves as a cost-effective alternative to Snowflake.

crates/iceberg/src/io/file_io.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use std::ops::Range;
2121
use std::sync::Arc;
2222

2323
use bytes::Bytes;
24-
use opendal::Operator;
24+
use opendal::{EntryMode, Lister, Operator};
2525
use url::Url;
2626

2727
use super::storage::Storage;
@@ -166,6 +166,16 @@ impl FileIO {
166166
relative_path_pos,
167167
})
168168
}
169+
170+
/// Returns a `Operator::lister` for the given path.
171+
///
172+
/// # Errors
173+
///
174+
/// If the operator fails to create a lister for the given path or `FileIO`
175+
pub async fn lister(&self, path: impl AsRef<str>) -> Result<Lister> {
176+
let (op, root_uri) = self.inner.create_operator(&path)?;
177+
Ok(op.lister(root_uri).await?)
178+
}
169179
}
170180

171181
/// Container for storing type-safe extensions used to configure underlying FileIO behavior.
@@ -287,6 +297,8 @@ impl FileIOBuilder {
287297
pub struct FileMetadata {
288298
/// The size of the file.
289299
pub size: u64,
300+
/// The file mode.
301+
pub mode: EntryMode,
290302
}
291303

292304
/// Trait for reading file.
@@ -337,6 +349,7 @@ impl InputFile {
337349

338350
Ok(FileMetadata {
339351
size: meta.content_length(),
352+
mode: meta.mode(),
340353
})
341354
}
342355

0 commit comments

Comments
 (0)