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!()
}
}Required Methods§
Trait Implementations§
Source§impl<'typetag> Serialize for dyn StorageFactory + 'typetag
impl<'typetag> Serialize for dyn StorageFactory + 'typetag
Source§impl<'typetag> Serialize for dyn StorageFactory + Send + 'typetag
impl<'typetag> Serialize for dyn StorageFactory + Send + 'typetag
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".