Skip to main content

StorageProvider

Trait StorageProvider 

Source
pub trait StorageProvider:
    Clone
    + Send
    + Sync
    + 'static {
    type File: StorageFile + 'static;

    // Required methods
    fn open(
        &self,
        path: &str,
        options: OpenOptions,
    ) -> impl Future<Output = Result<Self::File>> + Send;
    fn exists(&self, path: &str) -> impl Future<Output = Result<bool>> + Send;
    fn delete(&self, path: &str) -> impl Future<Output = Result<()>> + Send;
    fn rename(
        &self,
        from: &str,
        to: &str,
    ) -> impl Future<Output = Result<()>> + Send;
}
Expand description

Provider trait for file storage operations.

Clone allows sharing providers across multiple components efficiently.

Required Associated Types§

Source

type File: StorageFile + 'static

The file type for this provider.

Required Methods§

Source

fn open( &self, path: &str, options: OpenOptions, ) -> impl Future<Output = Result<Self::File>> + Send

Open a file with the given options.

Source

fn exists(&self, path: &str) -> impl Future<Output = Result<bool>> + Send

Check if a file exists at the given path.

Source

fn delete(&self, path: &str) -> impl Future<Output = Result<()>> + Send

Delete a file at the given path.

Source

fn rename( &self, from: &str, to: &str, ) -> impl Future<Output = Result<()>> + Send

Rename a file from one path to another.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl StorageProvider for TokioStorageProvider

Available on crate feature tokio-providers only.