ObjectStoreProvider

Trait ObjectStoreProvider 

Source
pub trait ObjectStoreProvider:
    Debug
    + Sync
    + Send {
    // Required method
    fn new_store<'life0, 'life1, 'async_trait>(
        &'life0 self,
        base_path: Url,
        params: &'life1 ObjectStoreParams,
    ) -> Pin<Box<dyn Future<Output = Result<ObjectStore>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided methods
    fn extract_path(&self, url: &Url) -> Result<Path> { ... }
    fn calculate_object_store_prefix(
        &self,
        url: &Url,
        _storage_options: Option<&HashMap<String, String>>,
    ) -> Result<String> { ... }
}

Required Methods§

Source

fn new_store<'life0, 'life1, 'async_trait>( &'life0 self, base_path: Url, params: &'life1 ObjectStoreParams, ) -> Pin<Box<dyn Future<Output = Result<ObjectStore>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Provided Methods§

Source

fn extract_path(&self, url: &Url) -> Result<Path>

Extract the path relative to the base of the store.

For example, in S3 the path is relative to the bucket. So a URL of s3://bucket/path/to/file would return path/to/file.

Meanwhile, for a file store, the path is relative to the filesystem root. So a URL of file:///path/to/file would return /path/to/file.

Source

fn calculate_object_store_prefix( &self, url: &Url, _storage_options: Option<&HashMap<String, String>>, ) -> Result<String>

Calculate the unique prefix that should be used for this object store.

For object stores that don’t have the concept of buckets, this will just be something like ‘file’ or ‘memory’.

In object stores where all bucket names are unique, like s3, this will be simply ‘s3$my_bucket_name’ or similar.

In Azure, only the combination of (account name, container name) is unique, so this will be something like ‘az$account_name@container’

Providers should override this if they have special requirements like Azure’s.

Implementors§