liurenjie1024 commented on code in PR #520:
URL: https://github.com/apache/iceberg-rust/pull/520#discussion_r1704136142


##########
crates/iceberg/src/io/storage.rs:
##########
@@ -117,7 +125,24 @@ impl Storage {
                     ))
                 }
             }
-            #[cfg(all(not(feature = "storage-s3"), not(feature = 
"storage-fs")))]
+            #[cfg(feature = "storage-gcs")]
+            Storage::Gcs { config } => {
+                let operator = super::gcs_config_build(config)?;
+                let prefix = format!("gs://{}/", operator.info().name());
+                if path.starts_with(&prefix) {
+                    Ok((operator, &path[prefix.len()..]))
+                } else {
+                    Err(Error::new(
+                        ErrorKind::DataInvalid,
+                        format!("Invalid gcs url: {}, should start with {}", 
path, prefix),
+                    ))
+                }
+            }
+            #[cfg(all(
+                not(feature = "storage-s3"),
+                not(feature = "storage-fs"),
+                not(feature = "storage-gcs")
+            ))]

Review Comment:
   Why we need to add this?



##########
crates/iceberg/Cargo.toml:
##########
@@ -29,12 +29,13 @@ license = { workspace = true }
 keywords = ["iceberg"]
 
 [features]
-default = ["storage-memory", "storage-fs", "storage-s3", "tokio"]
-storage-all = ["storage-memory", "storage-fs", "storage-s3"]
+default = ["storage-memory", "storage-fs", "storage-s3", "tokio", 
"storage-gcs"]

Review Comment:
   I'm hesitating to add `storage-gcs` to default feature.



##########
crates/iceberg/tests/file_io_gcs_test.rs:
##########
@@ -0,0 +1,103 @@
+// 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.
+
+//! Integration tests for FileIO Google Cloud Storage (GCS).
+
+use bytes::Bytes;
+use iceberg::io::{FileIO, FileIOBuilder, GCS_BUCKET, GCS_CREDENTIAL_PATH};
+use iceberg_test_utils::set_up;
+
+// static DOCKER_COMPOSE_ENV: RwLock<Option<DockerCompose>> = 
RwLock::new(None);
+
+// TODO: use compose with fake-gcs-server
+//#[ctor]
+//fn before_all() {
+//    let mut guard = DOCKER_COMPOSE_ENV.write().unwrap();
+//    let docker_compose = DockerCompose::new(
+//        normalize_test_name(module_path!()),
+//        format!("{}/testdata/file_io_gcs", env!("CARGO_MANIFEST_DIR")),
+//    );
+//    docker_compose.run();
+//    guard.replace(docker_compose);
+//}
+//
+//#[dtor]
+//fn after_all() {
+//    let mut guard = DOCKER_COMPOSE_ENV.write().unwrap();
+//    guard.take();
+//}
+
+async fn get_file_io_gcs() -> FileIO {
+    set_up();
+
+    FileIOBuilder::new("gcs")
+        .with_props(vec![
+            (GCS_BUCKET, std::env::var("GCS_BUCKET").unwrap().to_string()),
+            (
+                GCS_CREDENTIAL_PATH,
+                std::env::var("GCS_CREDENTIAL_PATH").unwrap().to_string(),
+            ),
+        ])
+        .build()
+        .unwrap()
+}
+
+fn get_gs_path() -> String {
+    format!(
+        "gs://{}",
+        std::env::var("GCS_BUCKET").expect("Only runs with var enabled")
+    )
+}
+
+#[tokio::test]
+#[test_with::env(GCS_BUCKET, GCS_CREDENTIAL_PATH)]

Review Comment:
   Sorry, I'm not sure that I'm following you correctly. Do you mean that 
`fake-gcs-server` doesn't support unauthorized access, while gsc could?



-- 
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