pub struct FileSystem { /* private fields */ }
Expand description
The in-memory file system!
This FileSystem
type can be cloned, it’s a light copy of the
FileSystemInner
(which is behind a Arc
+ RwLock
).
Implementations§
Source§impl FileSystem
impl FileSystem
Sourcepub fn insert_ro_file(
&self,
path: &Path,
contents: Cow<'static, [u8]>,
) -> Result<()>
pub fn insert_ro_file( &self, path: &Path, contents: Cow<'static, [u8]>, ) -> Result<()>
Inserts a readonly file into the file system that uses copy-on-write (this is required for zero-copy creation of the same file)
Sourcepub fn insert_arc_file_at(
&self,
target_path: PathBuf,
fs: Arc<dyn FileSystem + Send + Sync>,
source_path: PathBuf,
) -> Result<()>
pub fn insert_arc_file_at( &self, target_path: PathBuf, fs: Arc<dyn FileSystem + Send + Sync>, source_path: PathBuf, ) -> Result<()>
Inserts a arc file into the file system that references another file in another file system (does not copy the real data)
Sourcepub fn insert_arc_file(
&self,
target_path: PathBuf,
fs: Arc<dyn FileSystem + Send + Sync>,
) -> Result<()>
pub fn insert_arc_file( &self, target_path: PathBuf, fs: Arc<dyn FileSystem + Send + Sync>, ) -> Result<()>
Inserts a arc file into the file system that references another file in another file system (does not copy the real data)
Sourcepub fn insert_arc_directory_at(
&self,
target_path: PathBuf,
other: Arc<dyn FileSystem + Send + Sync>,
source_path: PathBuf,
) -> Result<()>
pub fn insert_arc_directory_at( &self, target_path: PathBuf, other: Arc<dyn FileSystem + Send + Sync>, source_path: PathBuf, ) -> Result<()>
Inserts a arc directory into the file system that references another file in another file system (does not copy the real data)
Sourcepub fn insert_arc_directory(
&self,
target_path: PathBuf,
other: Arc<dyn FileSystem + Send + Sync>,
) -> Result<()>
pub fn insert_arc_directory( &self, target_path: PathBuf, other: Arc<dyn FileSystem + Send + Sync>, ) -> Result<()>
Inserts a arc directory into the file system that references another file in another file system (does not copy the real data)
Sourcepub fn insert_device_file(
&self,
path: PathBuf,
file: Box<dyn VirtualFile + Send + Sync>,
) -> Result<()>
pub fn insert_device_file( &self, path: PathBuf, file: Box<dyn VirtualFile + Send + Sync>, ) -> Result<()>
Inserts a arc file into the file system that references another file in another file system (does not copy the real data)
Source§impl FileSystem
impl FileSystem
pub fn set_memory_limiter(&self, limiter: DynFsMemoryLimiter)
pub fn new_open_options_ext(&self) -> &FileSystem
Sourcepub fn with_backing_offload(self, buffer: OffloadBackingStore) -> Result<Self>
pub fn with_backing_offload(self, buffer: OffloadBackingStore) -> Result<Self>
Uses a mmap’ed file as a cache for file data thus removing the need to copy the data into memory.
This is especially important for journals as it means that the data stored within the journals does not need to be copied into memory, for very large journals this would otherwise be a problem.
Sourcepub fn canonicalize_unchecked(&self, path: &Path) -> Result<PathBuf>
pub fn canonicalize_unchecked(&self, path: &Path) -> Result<PathBuf>
Canonicalize a path without validating that it actually exists.
Sourcepub fn mount_directory_entries(
&self,
target_path: &Path,
other: &Arc<dyn FileSystem + Send + Sync>,
source_path: &Path,
) -> Result<()>
pub fn mount_directory_entries( &self, target_path: &Path, other: &Arc<dyn FileSystem + Send + Sync>, source_path: &Path, ) -> Result<()>
Merge all items from a given source path (directory) of a different file system into this file system.
Individual files and directories of the given path are mounted.
This function is not recursive, only the items in the source_path are mounted.
See Self::union
for mounting all inodes recursively.
pub fn union(&self, other: &Arc<dyn FileSystem + Send + Sync>)
pub fn mount( &self, target_path: PathBuf, other: &Arc<dyn FileSystem + Send + Sync>, source_path: PathBuf, ) -> Result<()>
Trait Implementations§
Source§impl Clone for FileSystem
impl Clone for FileSystem
Source§fn clone(&self) -> FileSystem
fn clone(&self) -> FileSystem
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for FileSystem
impl Debug for FileSystem
Source§impl Default for FileSystem
impl Default for FileSystem
Source§fn default() -> FileSystem
fn default() -> FileSystem
Source§impl FileOpener for FileSystem
impl FileOpener for FileSystem
fn open( &self, path: &Path, conf: &OpenOptionsConfig, ) -> Result<Box<dyn VirtualFile + Send + Sync + 'static>>
Source§impl FileSystem for FileSystem
impl FileSystem for FileSystem
fn readlink(&self, path: &Path) -> Result<PathBuf>
fn read_dir(&self, path: &Path) -> Result<ReadDir>
fn create_dir(&self, path: &Path) -> Result<()>
fn remove_dir(&self, path: &Path) -> Result<()>
fn rename<'a>( &'a self, from: &'a Path, to: &'a Path, ) -> BoxFuture<'a, Result<()>>
fn metadata(&self, path: &Path) -> Result<Metadata>
Source§fn symlink_metadata(&self, path: &Path) -> Result<Metadata>
fn symlink_metadata(&self, path: &Path) -> Result<Metadata>
metadata
because symlinks aren’t implemented
yet.fn remove_file(&self, path: &Path) -> Result<()>
fn new_open_options(&self) -> OpenOptions<'_>
fn mount( &self, _name: String, path: &Path, fs: Box<dyn FileSystem + Send + Sync>, ) -> Result<()>
Auto Trait Implementations§
impl Freeze for FileSystem
impl RefUnwindSafe for FileSystem
impl Send for FileSystem
impl Sync for FileSystem
impl Unpin for FileSystem
impl UnwindSafe for FileSystem
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)