xanderbailey commented on code in PR #2650:
URL: https://github.com/apache/iceberg-rust/pull/2650#discussion_r3542860749
##########
crates/iceberg/src/table.rs:
##########
@@ -113,8 +113,15 @@ impl TableBuilder {
/// If the table metadata has the `encryption.key-id` property set, a
/// [`KeyManagementClient`] must be provided here so the table can build
/// an [`EncryptionManager`]; otherwise [`Self::build`] will return an
error.
- pub fn kms_client(mut self, kms_client: Arc<dyn KeyManagementClient>) ->
Self {
- self.kms_client = Some(kms_client);
+ ///
+ /// Accepts either an `Arc<dyn KeyManagementClient>` or an
+ /// `Option<Arc<dyn KeyManagementClient>>`, so catalogs that hold an
+ /// optional client can forward it directly. Passing `None` is a no-op.
+ pub fn kms_client(
Review Comment:
I did it like this because else in all call sites you'd need:
```rust
if let Some(c) = &self.kms_client {
builder = builder.kms_client(c.clone());
}
```
which doesn't read very nicely in my opinion.
Would just `Option<...>` be better rather than the `Into`?
Seems like we get away with this for other fields because they're actually
always present when we use this builder but KMS client is legitimately optional.
--
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]