Struct virtual_fs::mem_fs::FileSystem
source · 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 more