Fokko commented on code in PR #53:
URL: https://github.com/apache/iceberg-rust/pull/53#discussion_r1326881650


##########
crates/iceberg/src/io.rs:
##########
@@ -0,0 +1,426 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+//! File io implementation.
+//!
+//! File io is built on top of 
[`opendal`](https://docs.rs/opendal/latest/opendal/index.html), which already 
provided an abstraction over all kinds of storage.
+//!
+//! # How to build `FileIO`
+//!
+//! We provided a `FileIOBuilder` to build `FileIO` from scratch. For example:
+//! ```rust
+//! use iceberg::io::{FileIOBuilder, S3_ARGS_BUCKET, S3_ARGS_REGION};
+//!
+//! let file_io = FileIOBuilder::new("s3")
+//!     .with_arg(S3_ARGS_BUCKET, "test_bucket")
+//!     .with_arg(S3_ARGS_REGION, "us-east-1")
+//!     .build()
+//!     .unwrap();
+//! ```
+//!
+//! We also provided a convenient method to build `FileIO` from url:
+//!
+//! ```rust
+//! use iceberg::io::{FileIO, S3_ARGS_REGION};
+//! let file_io = FileIO::build_from_url("s3a://test_bucket/warehouse")
+//!     .unwrap()
+//!     .with_arg(S3_ARGS_REGION, "us-east-1")
+//!     .build()
+//!     .unwrap();
+//! ```
+//!
+//! # How to use `FileIO`
+//!
+//! Currently `FileIO` provides simple methods for file operations:
+//!
+//! - `delete`: Delete file.
+//! - `is_exist`: Check if file exists.
+//! - `new_input`: Create input file for reading.
+//! - `new_output`: Create output file for writing.
+
+use std::{collections::HashMap, sync::Arc};
+
+use crate::{error::Result, Error, ErrorKind};
+use futures::{AsyncRead, AsyncSeek, AsyncWrite};
+use opendal::{Operator, Scheme};
+use url::Url;
+
+/// Following are arguments for s3 operator.
+/// s3 root
+pub const S3_ARGS_ROOT: &str = "root";

Review Comment:
   Doing the configuration in a separate PR makes sense to me. I have one final 
question about the configuration. For Java and Iceberg we've make sure that we 
stick to the same configuration settings:
   
   https://py.iceberg.apache.org/configuration/#s3
   
   <img width="968" alt="image" 
src="https://github.com/apache/iceberg-rust/assets/1134248/125ffff5-f4ca-4915-b847-e1c170c81b20";>
   
   For PyIceberg we have two implementations right now: S3FS, and PyArrow. Here 
we map the keys from the Iceberg naming to the specific implementation:
   
   
https://github.com/apache/iceberg/blob/master/python/pyiceberg/io/pyarrow.py#L305-L314
   
   I would suggest doing this for Rust as well because some of the catalogs 
provide a mechanism to inject credentials to access the table: 
https://github.com/apache/iceberg/blob/master/open-api/rest-catalog-open-api.yaml#L1899-L1904
   Otherwise, we would need to have a mapping for the different implementations.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to