pub struct FileStorageProvider { /* private fields */ }Expand description
Single-process local file provider with atomic replacement writes.
Implementations§
Source§impl FileStorageProvider
impl FileStorageProvider
Sourcepub fn create_snapshot_backup(
&self,
name: &str,
) -> StorageResult<BackupDescriptor>
pub fn create_snapshot_backup( &self, name: &str, ) -> StorageResult<BackupDescriptor>
Creates an atomic, checksummed snapshot of the complete data root.
Sourcepub fn verify_snapshot_backup(
&self,
name: &str,
) -> StorageResult<BackupDescriptor>
pub fn verify_snapshot_backup( &self, name: &str, ) -> StorageResult<BackupDescriptor>
Verifies a complete snapshot without changing current data.
Sourcepub fn restore_snapshot_backup(
&self,
name: &str,
) -> StorageResult<BackupDescriptor>
pub fn restore_snapshot_backup( &self, name: &str, ) -> StorageResult<BackupDescriptor>
Restores a verified snapshot through a recoverable directory swap.
Sourcepub fn recover_snapshot_restore(&self) -> StorageResult<()>
pub fn recover_snapshot_restore(&self) -> StorageResult<()>
Resolves interrupted restore phases without discarding the last good root.
Source§impl FileStorageProvider
impl FileStorageProvider
Sourcepub fn new(
storage_path: impl Into<PathBuf>,
backup_path: impl Into<PathBuf>,
) -> Self
pub fn new( storage_path: impl Into<PathBuf>, backup_path: impl Into<PathBuf>, ) -> Self
Creates a provider with separate data and backup roots.
Sourcepub fn create_dirs(&self) -> StorageResult<()>
pub fn create_dirs(&self) -> StorageResult<()>
Creates the configured data and backup directories.
Sourcepub fn write_bytes(&self, path: &str, bytes: &[u8]) -> StorageResult<()>
pub fn write_bytes(&self, path: &str, bytes: &[u8]) -> StorageResult<()>
Atomically writes bytes below the data root.
Sourcepub fn write_bytes_atomic(&self, path: &str, bytes: &[u8]) -> StorageResult<()>
pub fn write_bytes_atomic(&self, path: &str, bytes: &[u8]) -> StorageResult<()>
Writes through an exclusive temporary file, fsync and atomic rename.
Sourcepub fn write_secure_bytes<P: TokenProvider>(
&self,
path: &str,
bytes: &[u8],
provider: &P,
claims: &TokenClaims,
) -> StorageResult<()>
pub fn write_secure_bytes<P: TokenProvider>( &self, path: &str, bytes: &[u8], provider: &P, claims: &TokenClaims, ) -> StorageResult<()>
Seals and atomically writes bytes using an explicit token provider.
Sourcepub fn write_auth_required_bytes<P: TokenProvider>(
&self,
path: &str,
bytes: &[u8],
provider: Option<&P>,
claims: &TokenClaims,
) -> StorageResult<()>
pub fn write_auth_required_bytes<P: TokenProvider>( &self, path: &str, bytes: &[u8], provider: Option<&P>, claims: &TokenClaims, ) -> StorageResult<()>
Writes sealed bytes and fails when authentication is not configured.
Sourcepub fn write_remote_auth_required_bytes(
&self,
path: &str,
bytes: &[u8],
client: Option<&RemoteAuthStorageClient>,
) -> StorageResult<()>
pub fn write_remote_auth_required_bytes( &self, path: &str, bytes: &[u8], client: Option<&RemoteAuthStorageClient>, ) -> StorageResult<()>
Seals bytes through a remote authentication service before writing.
Sourcepub fn read_bytes(&self, path: &str) -> StorageResult<Vec<u8>>
pub fn read_bytes(&self, path: &str) -> StorageResult<Vec<u8>>
Reads bytes below the data root.
Sourcepub fn read_secure_bytes<P: TokenProvider>(
&self,
path: &str,
provider: &P,
claims: &TokenClaims,
) -> StorageResult<Vec<u8>>
pub fn read_secure_bytes<P: TokenProvider>( &self, path: &str, provider: &P, claims: &TokenClaims, ) -> StorageResult<Vec<u8>>
Reads and opens sealed bytes using an explicit token provider.
Sourcepub fn read_auth_required_bytes<P: TokenProvider>(
&self,
path: &str,
provider: Option<&P>,
claims: &TokenClaims,
) -> StorageResult<Vec<u8>>
pub fn read_auth_required_bytes<P: TokenProvider>( &self, path: &str, provider: Option<&P>, claims: &TokenClaims, ) -> StorageResult<Vec<u8>>
Reads sealed bytes and fails when authentication is not configured.
Sourcepub fn read_remote_auth_required_bytes(
&self,
path: &str,
client: Option<&RemoteAuthStorageClient>,
) -> StorageResult<Vec<u8>>
pub fn read_remote_auth_required_bytes( &self, path: &str, client: Option<&RemoteAuthStorageClient>, ) -> StorageResult<Vec<u8>>
Reads and opens bytes through a remote authentication service.
Sourcepub fn exists(&self, path: &str) -> StorageResult<bool>
pub fn exists(&self, path: &str) -> StorageResult<bool>
Reports whether a relative data path exists.
Sourcepub fn backup_file(&self, source: &str, backup_name: &str) -> StorageResult<()>
pub fn backup_file(&self, source: &str, backup_name: &str) -> StorageResult<()>
Atomically copies a data file below the backup root.
Sourcepub fn backup_file_atomic(
&self,
source: &str,
backup_name: &str,
) -> StorageResult<()>
pub fn backup_file_atomic( &self, source: &str, backup_name: &str, ) -> StorageResult<()>
Creates a backup through fsync and atomic replacement.
Sourcepub fn cleanup_temp_files(&self) -> StorageResult<usize>
pub fn cleanup_temp_files(&self) -> StorageResult<usize>
Removes orphaned temporary files below data and backup roots.
Trait Implementations§
Source§impl Clone for FileStorageProvider
impl Clone for FileStorageProvider
Source§fn clone(&self) -> FileStorageProvider
fn clone(&self) -> FileStorageProvider
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more