Trait StorageFactory

Source
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!()
    }
}

TODO remove below when the trait is integrated with FileIO and Catalog
This trait is under heavy development and is not used anywhere as of now
Please DO NOT implement it

Required Methods§

Source

fn build(&self, config: &StorageConfig) -> Result<Arc<dyn Storage>>

Build a new Storage instance from the given configuration.

§Arguments
  • config - The storage configuration containing scheme and properties
§Returns

A Result containing an Arc<dyn Storage> on success, or an error if the storage could not be created.

Trait Implementations§

Source§

impl<'typetag> Serialize for dyn StorageFactory + 'typetag

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<'typetag> Serialize for dyn StorageFactory + Send + 'typetag

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<'typetag> Serialize for dyn StorageFactory + Send + Sync + 'typetag

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<'typetag> Serialize for dyn StorageFactory + Sync + 'typetag

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more

Implementors§