Skip to main content

FileStorageProvider

Struct FileStorageProvider 

Source
pub struct FileStorageProvider { /* private fields */ }
Expand description

Single-process local file provider with atomic replacement writes.

Implementations§

Source§

impl FileStorageProvider

Source

pub fn create_snapshot_backup( &self, name: &str, ) -> StorageResult<BackupDescriptor>

Creates an atomic, checksummed snapshot of the complete data root.

Source

pub fn verify_snapshot_backup( &self, name: &str, ) -> StorageResult<BackupDescriptor>

Verifies a complete snapshot without changing current data.

Source

pub fn restore_snapshot_backup( &self, name: &str, ) -> StorageResult<BackupDescriptor>

Restores a verified snapshot through a recoverable directory swap.

Source

pub fn recover_snapshot_restore(&self) -> StorageResult<()>

Resolves interrupted restore phases without discarding the last good root.

Source§

impl FileStorageProvider

Source

pub fn new( storage_path: impl Into<PathBuf>, backup_path: impl Into<PathBuf>, ) -> Self

Creates a provider with separate data and backup roots.

Source

pub fn create_dirs(&self) -> StorageResult<()>

Creates the configured data and backup directories.

Source

pub fn write_bytes(&self, path: &str, bytes: &[u8]) -> StorageResult<()>

Atomically writes bytes below the data root.

Source

pub fn write_bytes_atomic(&self, path: &str, bytes: &[u8]) -> StorageResult<()>

Writes through an exclusive temporary file, fsync and atomic rename.

Source

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.

Source

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.

Source

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.

Source

pub fn read_bytes(&self, path: &str) -> StorageResult<Vec<u8>>

Reads bytes below the data root.

Source

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.

Source

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.

Source

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.

Source

pub fn exists(&self, path: &str) -> StorageResult<bool>

Reports whether a relative data path exists.

Source

pub fn backup_file(&self, source: &str, backup_name: &str) -> StorageResult<()>

Atomically copies a data file below the backup root.

Source

pub fn backup_file_atomic( &self, source: &str, backup_name: &str, ) -> StorageResult<()>

Creates a backup through fsync and atomic replacement.

Source

pub fn cleanup_temp_files(&self) -> StorageResult<usize>

Removes orphaned temporary files below data and backup roots.

Trait Implementations§

Source§

impl Clone for FileStorageProvider

Source§

fn clone(&self) -> FileStorageProvider

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FileStorageProvider

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl StorageCapabilityProviderV1 for FileStorageProvider

Source§

fn storage_capabilities_v1( &self, ) -> Result<StorageCapabilityDescriptorV1, StorageCapabilityError>

Returns an immutable descriptor without probing or opening the provider.
Source§

impl StorageProvider for FileStorageProvider

Source§

fn status(&self) -> StorageStatus

Returns coarse provider availability.
Source§

fn health(&self) -> StorageHealth

Returns a current provider health snapshot.
Source§

fn open(&mut self) -> StorageResult<()>

Opens and validates provider resources.
Source§

fn close(&mut self) -> StorageResult<()>

Closes provider resources.
Source§

fn begin_transaction(&mut self) -> StorageResult<Box<dyn Transaction>>

Begins a real unit of work or fails explicitly when unsupported.
Source§

fn list_backups(&self) -> Vec<BackupDescriptor>

Lists provider-owned backups.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V