plusplusjiajia commented on code in PR #2651:
URL: https://github.com/apache/iceberg-rust/pull/2651#discussion_r4682644941


##########
crates/storage/opendal/src/resolving.rs:
##########
@@ -272,12 +279,30 @@ impl OpenDalResolvingStorage {
             return Ok(storage.clone());
         }
 
-        let storage = build_storage_for_scheme(
-            scheme,
-            &self.props,
-            #[cfg(feature = "opendal-s3")]
-            &self.customized_credential_load,
-        )?;
+        // A prefix such as `s3://bucket/` or `s3` names its scheme, and never
+        // matches the paths of another.
+        let storage_credentials = self
+            .storage_credentials
+            .iter()
+            .filter(|credential| {
+                let prefix = credential.prefix();
+                let name = prefix.split_once(':').map_or(prefix, |(name, _)| 
name);
+                parse_scheme(&name.to_ascii_lowercase()).map_or(true, |s| s == 
scheme)

Review Comment:
   Good catch, thanks. Credentials with an unsupported scheme are now skipped, 
and I added your `future://bucket/` case to 
`test_resolve_ignores_credentials_for_other_schemes`; it failed before the fix.
   



##########
crates/storage/opendal/src/resolving.rs:
##########
@@ -235,9 +239,12 @@ impl StorageFactory for OpenDalResolvingStorageFactory {
 pub struct OpenDalResolvingStorage {
     /// Configuration properties shared across all backends.
     props: HashMap<String, String>,
+    /// Credentials that apply to locations under their prefixes.
+    #[serde(default, skip_serializing_if = "Vec::is_empty")]
+    storage_credentials: Vec<StorageCredential>,

Review Comment:
   Done, it now holds a `StorageConfig`.
   



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to