DerGut commented on code in PR #3081:
URL: https://github.com/apache/iceberg-rust/pull/3081#discussion_r3994265831


##########
crates/catalog/rest/src/catalog.rs:
##########
@@ -416,10 +418,14 @@ pub(crate) fn oauth_params_from_props(props: 
&HashMap<String, String>) -> HashMa
     params
 }
 
-#[derive(Debug)]
 struct RestClient {
-    /// Carries the session the auth manager derived from the merged
-    /// configuration, so every request below is authenticated.
+    /// The manager that created `catalog_session`; retained so each request 
can
+    /// derive authentication for its [`SessionContext`].
+    auth_manager: Arc<dyn AuthManager>,
+    /// The catalog-wide session passed to [`AuthManager::contextual_session`].
+    catalog_session: Arc<dyn AuthSession>,

Review Comment:
   1. the auth manager has no dependency on sessions and shouldn't have to be 
loaded lazily -> it should be constructed by the builder
   2.  going a step further, auth manager resolution only requires the 
`RestConfig`'s properties, I'm exploring whether we shouldn't move the auth 
manager to the config and change it from a `TypedBuilder` pattern to a custom 
builder that returns a `Result<RestConfig>` with a resolved auth manager. This 
would avoid an `Arc<dyn AuthManager>` on the catalog just to pass it to 
`RestCatalogClient` initialization (and then not use it again)



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