pub trait FileSystemWriter:
Environment
+ Send
+ Sync {
// Required methods
fn WriteFile<'life0, 'life1, 'async_trait>(
&'life0 self,
Path: &'life1 PathBuf,
Content: Vec<u8>,
Create: bool,
Overwrite: bool,
) -> Pin<Box<dyn Future<Output = Result<(), CommonError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn CreateDirectory<'life0, 'life1, 'async_trait>(
&'life0 self,
Path: &'life1 PathBuf,
Recursive: bool,
) -> Pin<Box<dyn Future<Output = Result<(), CommonError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn Delete<'life0, 'life1, 'async_trait>(
&'life0 self,
Path: &'life1 PathBuf,
Recursive: bool,
UseTrash: bool,
) -> Pin<Box<dyn Future<Output = Result<(), CommonError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn Rename<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
Source: &'life1 PathBuf,
Target: &'life2 PathBuf,
Overwrite: bool,
) -> Pin<Box<dyn Future<Output = Result<(), CommonError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn Copy<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
Source: &'life1 PathBuf,
Target: &'life2 PathBuf,
Overwrite: bool,
) -> Pin<Box<dyn Future<Output = Result<(), CommonError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn CreateFile<'life0, 'life1, 'async_trait>(
&'life0 self,
Path: &'life1 PathBuf,
) -> Pin<Box<dyn Future<Output = Result<(), CommonError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}Expand description
An abstract service contract for an environment component that can perform write and modification filesystem operations.
This trait is implemented by MountainEnvironment and typically uses
tokio::fs to fulfill the contract. Separating write operations from read
operations enhances security by allowing capabilities to be granted on a
need-to-know basis.
Required Methods§
Sourcefn WriteFile<'life0, 'life1, 'async_trait>(
&'life0 self,
Path: &'life1 PathBuf,
Content: Vec<u8>,
Create: bool,
Overwrite: bool,
) -> Pin<Box<dyn Future<Output = Result<(), CommonError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn WriteFile<'life0, 'life1, 'async_trait>(
&'life0 self,
Path: &'life1 PathBuf,
Content: Vec<u8>,
Create: bool,
Overwrite: bool,
) -> Pin<Box<dyn Future<Output = Result<(), CommonError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Writes byte content to a file.
§Parameters
Path: The path of the file to write to.Content: The byte vector to write.Create: Iftrue, the file will be created if it does not exist.Overwrite: Iftrue, an existing file will be overwritten.
Sourcefn CreateDirectory<'life0, 'life1, 'async_trait>(
&'life0 self,
Path: &'life1 PathBuf,
Recursive: bool,
) -> Pin<Box<dyn Future<Output = Result<(), CommonError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn CreateDirectory<'life0, 'life1, 'async_trait>(
&'life0 self,
Path: &'life1 PathBuf,
Recursive: bool,
) -> Pin<Box<dyn Future<Output = Result<(), CommonError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Creates a directory at the specified path.
§Parameters
Path: The path of the directory to create.Recursive: Iftrue, creates all parent directories as needed.
Sourcefn Delete<'life0, 'life1, 'async_trait>(
&'life0 self,
Path: &'life1 PathBuf,
Recursive: bool,
UseTrash: bool,
) -> Pin<Box<dyn Future<Output = Result<(), CommonError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn Delete<'life0, 'life1, 'async_trait>(
&'life0 self,
Path: &'life1 PathBuf,
Recursive: bool,
UseTrash: bool,
) -> Pin<Box<dyn Future<Output = Result<(), CommonError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Deletes a file or directory.
§Parameters
Path: The path of the item to delete.Recursive: Iftrue, deletes a directory and all its contents.UseTrash: Iftrue, moves the item to the system’s trash or recycling bin instead of permanently deleting it.
Sourcefn Rename<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
Source: &'life1 PathBuf,
Target: &'life2 PathBuf,
Overwrite: bool,
) -> Pin<Box<dyn Future<Output = Result<(), CommonError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn Rename<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
Source: &'life1 PathBuf,
Target: &'life2 PathBuf,
Overwrite: bool,
) -> Pin<Box<dyn Future<Output = Result<(), CommonError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Renames (moves) a file or directory.
§Parameters
Source: The original path of the item.Target: The new path for the item.Overwrite: Iftrue, an existing item at the target path will be overwritten.
Sourcefn Copy<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
Source: &'life1 PathBuf,
Target: &'life2 PathBuf,
Overwrite: bool,
) -> Pin<Box<dyn Future<Output = Result<(), CommonError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn Copy<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
Source: &'life1 PathBuf,
Target: &'life2 PathBuf,
Overwrite: bool,
) -> Pin<Box<dyn Future<Output = Result<(), CommonError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Copies a file or directory.
§Parameters
Source: The path of the item to copy.Target: The destination path for the copy.Overwrite: Iftrue, an existing item at the target path will be overwritten.
Sourcefn CreateFile<'life0, 'life1, 'async_trait>(
&'life0 self,
Path: &'life1 PathBuf,
) -> Pin<Box<dyn Future<Output = Result<(), CommonError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn CreateFile<'life0, 'life1, 'async_trait>(
&'life0 self,
Path: &'life1 PathBuf,
) -> Pin<Box<dyn Future<Output = Result<(), CommonError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Creates a new, empty file at the specified path. This is a convenience method that will fail if the file already exists.