CTTY commented on code in PR #2247:
URL: https://github.com/apache/iceberg-rust/pull/2247#discussion_r2977701186
##########
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:
I've updated the API to be
```rust
fn build(
&self,
config: &StorageConfig,
metadata: Option<&TableMetadata>,
) -> Result<Arc<dyn Storage>>;
```
at some place you will have to have a `FileIO` constructed before you have a
metadata object, and I think we should at least allow users to pass `None` in
that case. An alternative is to pass in "default" TableMetadata but it seems
hacky
--
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]