pub trait StorageFactory:
Debug
+ Send
+ Sync
+ Serialize
+ Deserialize {
// Required method
fn build(&self, config: &StorageConfig) -> Result<Arc<dyn Storage>>;
}Expand description
Factory for creating Storage instances from configuration.
Implement this trait to provide custom storage backends. The factory pattern allows for lazy initialization of storage instances and enables users to inject custom storage implementations into catalogs.
§Example
ⓘ
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
struct MyCustomStorageFactory {
// custom configuration
}
#[typetag::serde]
impl StorageFactory for MyCustomStorageFactory {
fn build(&self, config: &StorageConfig) -> Result<Arc<dyn Storage>> {
// Create and return custom storage implementation
todo!()
}
}