pub struct FileStorage { /* private fields */ }
Expand description
File-based storage backend with atomic operations and encryption
Implementations§
Source§impl FileStorage
impl FileStorage
pub async fn new( path: PathBuf, file_permissions: u32, dir_permissions: u32, require_secure_filesystem: bool, enable_filesystem_monitoring: bool, ) -> Result<Self, StorageError>
Sourcepub async fn create_backup(&self) -> Result<PathBuf, StorageError>
pub async fn create_backup(&self) -> Result<PathBuf, StorageError>
Create a secure backup of the storage file
Sourcepub async fn restore_from_backup(
&self,
backup_path: &PathBuf,
) -> Result<(), StorageError>
pub async fn restore_from_backup( &self, backup_path: &PathBuf, ) -> Result<(), StorageError>
Restore from a backup file
Sourcepub async fn cleanup_backups(
&self,
keep_count: usize,
) -> Result<(), StorageError>
pub async fn cleanup_backups( &self, keep_count: usize, ) -> Result<(), StorageError>
Clean up old backup files (keep only last N backups)
Sourcepub async fn start_filesystem_monitoring(&self) -> Result<(), StorageError>
pub async fn start_filesystem_monitoring(&self) -> Result<(), StorageError>
Start filesystem monitoring for unauthorized changes (Linux only)
Trait Implementations§
Source§impl StorageBackend for FileStorage
impl StorageBackend for FileStorage
fn load_keys<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<HashMap<String, ApiKey>, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn save_key<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 ApiKey,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete_key<'life0, 'life1, 'async_trait>(
&'life0 self,
key_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn save_all_keys<'life0, 'life1, 'async_trait>(
&'life0 self,
keys: &'life1 HashMap<String, ApiKey>,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Auto Trait Implementations§
impl Freeze for FileStorage
impl RefUnwindSafe for FileStorage
impl Send for FileStorage
impl Sync for FileStorage
impl Unpin for FileStorage
impl UnwindSafe for FileStorage
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more