pub struct RestoreFileCommand {
pub source_adapipe_path: PathBuf,
pub target_path: PathBuf,
pub overwrite: bool,
pub create_directories: bool,
pub validate_permissions: bool,
}Expand description
Command to restore a file from .adapipe format.
This command encapsulates all the information needed to restore a file from the pipeline’s compressed and processed format back to its original form. It follows the Command pattern and supports the builder pattern for flexible configuration.
§Command Properties
- Immutable: Once created, the command cannot be modified (except through builder methods)
- Self-Contained: Contains all information needed for execution
- Validatable: Can be validated before execution
- Auditable: Provides clear operation tracking
§Usage Examples
§Basic File Restoration
§Advanced Configuration
§Batch Processing Setup
§Validation
Commands should be validated before execution to ensure:
- Source file exists and is readable
- Target directory is writable
- Sufficient disk space is available
- Permissions allow the operation
§Error Handling
Command execution can fail for various reasons:
- Source file not found or corrupted
- Insufficient permissions
- Disk space exhausted
- Target file already exists (when overwrite is false)
- Invalid .adapipe format
§Performance Considerations
- Large files may require streaming restoration
- Multiple commands can be processed concurrently
- Progress tracking may be needed for long operations
- Memory usage scales with file size and concurrency
Fields§
§source_adapipe_path: PathBufPath to the .adapipe file to restore from
target_path: PathBufTarget directory or file path for restoration
overwrite: boolWhether to overwrite existing files
create_directories: boolWhether to create missing directories
validate_permissions: boolWhether to validate permissions before restoration
Implementations§
Source§impl RestoreFileCommand
impl RestoreFileCommand
pub fn new(source_adapipe_path: PathBuf, target_path: PathBuf) -> Self
pub fn with_overwrite(self, overwrite: bool) -> Self
pub fn with_create_directories(self, create_directories: bool) -> Self
pub fn with_permission_validation(self, validate: bool) -> Self
Trait Implementations§
Source§impl Clone for RestoreFileCommand
impl Clone for RestoreFileCommand
Source§fn clone(&self) -> RestoreFileCommand
fn clone(&self) -> RestoreFileCommand
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for RestoreFileCommand
impl RefUnwindSafe for RestoreFileCommand
impl Send for RestoreFileCommand
impl Sync for RestoreFileCommand
impl Unpin for RestoreFileCommand
impl UnwindSafe for RestoreFileCommand
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more