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§
Sourcefn write_file_str(
&self,
path: &str,
data: &[u8],
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + '_>>
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
Sourcefn read_file_str(
&self,
path: &str,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, StorageError>> + Send + '_>>
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
Sourcefn exists_str(&self, path: &str) -> bool
fn exists_str(&self, path: &str) -> bool
Check if a file exists at the specified path
Sourcefn remove_str(
&self,
path: &str,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + '_>>
fn remove_str( &self, path: &str, ) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + '_>>
Remove a file at the specified path