amogh-jahagirdar commented on code in PR #2692:
URL: https://github.com/apache/iceberg-rust/pull/2692#discussion_r3530467888
##########
crates/catalog/rest/src/catalog.rs:
##########
@@ -412,14 +417,42 @@ impl RestCatalog {
.get_or_try_init(|| async {
let client = HttpClient::new(&self.user_config)?;
let catalog_config = RestCatalog::load_config(&client,
&self.user_config).await?;
+ // The `endpoints` field is optional. A non-empty advertised
list
+ // is used as-is; an absent field or an empty list falls back
to
+ // the standard base set every server is expected to support.
+ let endpoints = match &catalog_config.endpoints {
+ Some(advertised) if !advertised.is_empty() => {
+ advertised.iter().cloned().collect()
+ }
+ _ => crate::endpoint::DEFAULT_ENDPOINTS.clone(),
+ };
let config =
self.user_config.clone().merge_with_config(catalog_config);
let client = client.update_with(&config)?;
- Ok(RestContext { config, client })
+ Ok(RestContext {
+ config,
+ client,
+ endpoints,
+ })
})
.await
}
+ /// Returns whether the connected server supports `endpoint`.
+ ///
+ /// Servers advertise the routes they support in the `endpoints` field of
+ /// the `GET /v1/config` response. A non-empty advertised list is used
as-is.
+ /// An absent field or an empty list falls back to a standard base set of
+ /// namespace and table operations, so a server that predates the field
still
+ /// resolves its core operations as supported; any optional endpoint
outside
+ /// that base set is reported unsupported unless it is explicitly
advertised.
+ ///
+ /// The server config is fetched once and cached, so the first call may
Review Comment:
Same here, we don't need to document the protocol a bunch of times. Just
once and concisely should be enough
--
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]