CTTY commented on code in PR #2247:
URL: https://github.com/apache/iceberg-rust/pull/2247#discussion_r2968127115
##########
crates/iceberg/src/io/storage/mod.rs:
##########
@@ -128,6 +129,19 @@ pub trait Storage: Debug + Send + Sync {
/// ```
#[typetag::serde(tag = "type")]
pub trait StorageFactory: Debug + Send + Sync {
+ /// Create a new factory instance enriched with table metadata.
+ ///
+ /// This allows storage factories to incorporate table-level metadata
+ /// (e.g., table properties) into the storage initialization.
+ ///
+ /// Implementations that don't need table metadata should return
+ /// a clone of themselves: `Ok(Arc::new(self.clone()))`.
+ ///
+ /// # Arguments
+ ///
+ /// * `metadata` - The table metadata to incorporate
+ fn with_metadata(&self, metadata: &TableMetadata) -> Result<Arc<dyn
StorageFactory>>;
Review Comment:
My concern about having `build_with_metadata` is that it means we will need
to thread the metadata through FileIO / FileIOBuilder — something like
`FileIOBuilder::with_metadata(metadata)` that stores it, and then
`FileIO::get_storage` calls `build_with_metadata` when metadata is present, or
build when it's not. I think metadata can be heavy to be passed around
I think just having `with_metadata` is much lighter and custom
implementations can only extract what they need upfront rather than iceberg
holding metadata info until `build`
--
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]