StorageBackend

Trait StorageBackend 

Source
pub trait StorageBackend: Send + Sync {
    // Required methods
    fn write_file_str(
        &self,
        path: &str,
        data: &[u8],
    ) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + '_>>;
    fn read_file_str(
        &self,
        path: &str,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, StorageError>> + Send + '_>>;
    fn exists_str(&self, path: &str) -> bool;
    fn remove_str(
        &self,
        path: &str,
    ) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + '_>>;
}
Expand description

Storage backend trait for persisting data

This trait abstracts storage operations to allow for different storage implementations (filesystem, keyring, etc.)

Required Methods§

Source

fn write_file_str( &self, path: &str, data: &[u8], ) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + '_>>

Write data to storage at the specified path

Source

fn read_file_str( &self, path: &str, ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, StorageError>> + Send + '_>>

Read data from storage at the specified path

Source

fn exists_str(&self, path: &str) -> bool

Check if a file exists at the specified path

Source

fn remove_str( &self, path: &str, ) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + '_>>

Remove a file at the specified path

Implementors§