Skip to content

Commit c354983

Browse files
authored
doc: improve FileIO doc (apache#642)
Signed-off-by: xxchan <[email protected]>
1 parent 12e12e2 commit c354983

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

crates/iceberg/src/io/file_io.rs

+13-3
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,25 @@ use crate::{Error, ErrorKind, Result};
3232
///
3333
/// All path passed to `FileIO` must be absolute path starting with scheme string used to construct `FileIO`.
3434
/// For example, if you construct `FileIO` with `s3a` scheme, then all path passed to `FileIO` must start with `s3a://`.
35+
///
36+
/// Supported storages:
37+
///
38+
/// | Storage | Feature Flag | Schemes |
39+
/// |--------------------|-------------------|------------|
40+
/// | Local file system | `storage-fs` | `file` |
41+
/// | Memory | `storage-memory` | `memory` |
42+
/// | S3 | `storage-s3` | `s3`, `s3a`|
43+
/// | GCS | `storage-gcs` | `gs` |
3544
#[derive(Clone, Debug)]
3645
pub struct FileIO {
3746
inner: Arc<Storage>,
3847
}
3948

4049
impl FileIO {
41-
/// Try to infer file io scheme from path.
50+
/// Try to infer file io scheme from path. See [`FileIO`] for supported schemes.
4251
///
43-
/// If it's a valid url, for example http://example.org, url scheme will be used.
44-
/// If it's not a valid url, will try to detect if it's a file path.
52+
/// - If it's a valid url, for example `s3://bucket/a`, url scheme will be used, and the rest of the url will be ignored.
53+
/// - If it's not a valid url, will try to detect if it's a file path.
4554
///
4655
/// Otherwise will return parsing error.
4756
pub fn from_path(path: impl AsRef<str>) -> crate::Result<FileIOBuilder> {
@@ -111,6 +120,7 @@ pub struct FileIOBuilder {
111120

112121
impl FileIOBuilder {
113122
/// Creates a new builder with scheme.
123+
/// See [`FileIO`] for supported schemes.
114124
pub fn new(scheme_str: impl ToString) -> Self {
115125
Self {
116126
scheme_str: Some(scheme_str.to_string()),

crates/iceberg/src/io/storage.rs

+1
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ impl Storage {
6969
Scheme::Gcs => Ok(Self::Gcs {
7070
config: super::gcs_config_parse(props)?.into(),
7171
}),
72+
// Update doc on [`FileIO`] when adding new schemes.
7273
_ => Err(Error::new(
7374
ErrorKind::FeatureUnsupported,
7475
format!("Constructing file io from scheme: {scheme} not supported now",),

0 commit comments

Comments
 (0)