-
Notifications
You must be signed in to change notification settings - Fork 436
feat!(storage): Add with_metadata to storage factory, update load_file_io #2247
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,6 +33,7 @@ pub use memory::{MemoryStorage, MemoryStorageFactory}; | |
|
|
||
| use super::{FileMetadata, FileRead, FileWrite, InputFile, OutputFile}; | ||
| use crate::Result; | ||
| use crate::spec::TableMetadata; | ||
|
|
||
| /// Trait for storage operations in Iceberg. | ||
| /// | ||
|
|
@@ -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>>; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this should be part of
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My concern about having I think just having |
||
|
|
||
| /// Build a new Storage instance from the given configuration. | ||
| /// | ||
| /// # Arguments | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need these checks anymore since now we rely on a configured
StorageFactory