DerGut commented on code in PR #2999:
URL: https://github.com/apache/iceberg-rust/pull/2999#discussion_r3787790322
##########
crates/iceberg/src/catalog/session.rs:
##########
@@ -197,14 +234,127 @@ pub trait SessionCatalog: Debug + Send + Sync {
async fn update_table(&self, context: &SessionContext, commit:
TableCommit) -> Result<Table>;
}
+impl dyn SessionCatalog {
+ /// Bind this catalog to a session, exposing the ordinary Catalog API.
+ ///
+ /// # Example
+ /// ```
+ /// # fn into_catalog(session_catalog: Arc<dyn SessionCatalog>, id:
String) {
+ /// let session = SessionContext::builder().session_id(id).build();
+ ///
+ /// // Use the plain catalog API for the duration of this session.
+ /// let catalog = session_catalog.into_catalog(session);
+ /// # let _ = catalog;
+ /// # }
+ /// ```
+ pub fn into_catalog(self: Arc<Self>, session: SessionContext) -> Arc<dyn
Catalog> {
Review Comment:
`into_catalog` is close enough to Java's `asCatalog` while better fitting
into Rust's conventional `as_`, `into_`, `to_` naming where `as_catalog` would
suggest a cheap borrowing conversion.
--
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]