pub trait ExecutorFileSystem: Send + Sync {
// Required methods
fn canonicalize<'a>(
&'a self,
path: &'a PathUri,
sandbox: Option<&'a FileSystemSandboxContext>,
) -> Pin<Box<dyn Future<Output = Result<PathUri, Error>> + Send + 'a>>;
fn read_file<'a>(
&'a self,
path: &'a PathUri,
sandbox: Option<&'a FileSystemSandboxContext>,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, Error>> + Send + 'a>>;
fn read_file_stream<'a>(
&'a self,
path: &'a PathUri,
sandbox: Option<&'a FileSystemSandboxContext>,
) -> Pin<Box<dyn Future<Output = Result<FileSystemReadStream, Error>> + Send + 'a>>;
fn write_file<'a>(
&'a self,
path: &'a PathUri,
contents: Vec<u8>,
sandbox: Option<&'a FileSystemSandboxContext>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>>;
fn create_directory<'a>(
&'a self,
path: &'a PathUri,
create_directory_options: CreateDirectoryOptions,
sandbox: Option<&'a FileSystemSandboxContext>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>>;
fn get_metadata<'a>(
&'a self,
path: &'a PathUri,
sandbox: Option<&'a FileSystemSandboxContext>,
) -> Pin<Box<dyn Future<Output = Result<FileMetadata, Error>> + Send + 'a>>;
fn read_directory<'a>(
&'a self,
path: &'a PathUri,
sandbox: Option<&'a FileSystemSandboxContext>,
) -> Pin<Box<dyn Future<Output = Result<Vec<ReadDirectoryEntry>, Error>> + Send + 'a>>;
fn remove<'a>(
&'a self,
path: &'a PathUri,
remove_options: RemoveOptions,
sandbox: Option<&'a FileSystemSandboxContext>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>>;
fn copy<'a>(
&'a self,
source_path: &'a PathUri,
destination_path: &'a PathUri,
copy_options: CopyOptions,
sandbox: Option<&'a FileSystemSandboxContext>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>>;
// Provided methods
fn read_file_text<'a>(
&'a self,
path: &'a PathUri,
sandbox: Option<&'a FileSystemSandboxContext>,
) -> Pin<Box<dyn Future<Output = Result<String, Error>> + Send + 'a>> { ... }
fn walk<'a>(
&'a self,
path: &'a PathUri,
options: WalkOptions,
sandbox: Option<&'a FileSystemSandboxContext>,
) -> Pin<Box<dyn Future<Output = Result<WalkOutcome, Error>> + Send + 'a>> { ... }
fn walk_via_directory_reads<'a>(
&'a self,
path: &'a PathUri,
options: WalkOptions,
sandbox: Option<&'a FileSystemSandboxContext>,
) -> Pin<Box<dyn Future<Output = Result<WalkOutcome, Error>> + Send + 'a>> { ... }
}Expand description
Abstract filesystem access used by components that may operate locally or via a remote environment.
Required Methods§
Sourcefn canonicalize<'a>(
&'a self,
path: &'a PathUri,
sandbox: Option<&'a FileSystemSandboxContext>,
) -> Pin<Box<dyn Future<Output = Result<PathUri, Error>> + Send + 'a>>
fn canonicalize<'a>( &'a self, path: &'a PathUri, sandbox: Option<&'a FileSystemSandboxContext>, ) -> Pin<Box<dyn Future<Output = Result<PathUri, Error>> + Send + 'a>>
Resolves a path within this filesystem.
fn read_file<'a>( &'a self, path: &'a PathUri, sandbox: Option<&'a FileSystemSandboxContext>, ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, Error>> + Send + 'a>>
Sourcefn read_file_stream<'a>(
&'a self,
path: &'a PathUri,
sandbox: Option<&'a FileSystemSandboxContext>,
) -> Pin<Box<dyn Future<Output = Result<FileSystemReadStream, Error>> + Send + 'a>>
fn read_file_stream<'a>( &'a self, path: &'a PathUri, sandbox: Option<&'a FileSystemSandboxContext>, ) -> Pin<Box<dyn Future<Output = Result<FileSystemReadStream, Error>> + Send + 'a>>
Reads a file as a stream of chunks no larger than FILE_READ_CHUNK_SIZE.
fn write_file<'a>( &'a self, path: &'a PathUri, contents: Vec<u8>, sandbox: Option<&'a FileSystemSandboxContext>, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>>
fn create_directory<'a>( &'a self, path: &'a PathUri, create_directory_options: CreateDirectoryOptions, sandbox: Option<&'a FileSystemSandboxContext>, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>>
fn get_metadata<'a>( &'a self, path: &'a PathUri, sandbox: Option<&'a FileSystemSandboxContext>, ) -> Pin<Box<dyn Future<Output = Result<FileMetadata, Error>> + Send + 'a>>
fn read_directory<'a>( &'a self, path: &'a PathUri, sandbox: Option<&'a FileSystemSandboxContext>, ) -> Pin<Box<dyn Future<Output = Result<Vec<ReadDirectoryEntry>, Error>> + Send + 'a>>
fn remove<'a>( &'a self, path: &'a PathUri, remove_options: RemoveOptions, sandbox: Option<&'a FileSystemSandboxContext>, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>>
fn copy<'a>( &'a self, source_path: &'a PathUri, destination_path: &'a PathUri, copy_options: CopyOptions, sandbox: Option<&'a FileSystemSandboxContext>, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>>
Provided Methods§
Sourcefn read_file_text<'a>(
&'a self,
path: &'a PathUri,
sandbox: Option<&'a FileSystemSandboxContext>,
) -> Pin<Box<dyn Future<Output = Result<String, Error>> + Send + 'a>>
fn read_file_text<'a>( &'a self, path: &'a PathUri, sandbox: Option<&'a FileSystemSandboxContext>, ) -> Pin<Box<dyn Future<Output = Result<String, Error>> + Send + 'a>>
Reads a file and decodes it as UTF-8 text.
Sourcefn walk<'a>(
&'a self,
path: &'a PathUri,
options: WalkOptions,
sandbox: Option<&'a FileSystemSandboxContext>,
) -> Pin<Box<dyn Future<Output = Result<WalkOutcome, Error>> + Send + 'a>>
fn walk<'a>( &'a self, path: &'a PathUri, options: WalkOptions, sandbox: Option<&'a FileSystemSandboxContext>, ) -> Pin<Box<dyn Future<Output = Result<WalkOutcome, Error>> + Send + 'a>>
Recursively lists descendants, optionally following directory symlinks.
Sourcefn walk_via_directory_reads<'a>(
&'a self,
path: &'a PathUri,
options: WalkOptions,
sandbox: Option<&'a FileSystemSandboxContext>,
) -> Pin<Box<dyn Future<Output = Result<WalkOutcome, Error>> + Send + 'a>>
fn walk_via_directory_reads<'a>( &'a self, path: &'a PathUri, options: WalkOptions, sandbox: Option<&'a FileSystemSandboxContext>, ) -> Pin<Box<dyn Future<Output = Result<WalkOutcome, Error>> + Send + 'a>>
Performs a bounded walk using the primitive filesystem operations.
Implementations with an optimized walk transport can use this as a compatibility fallback.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".