Struct virtual_fs::mem_fs::filesystem::FileSystem
source · pub struct FileSystem {
pub(super) inner: Arc<RwLock<FileSystemInner>>,
}
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
).
Fields§
§inner: Arc<RwLock<FileSystemInner>>
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)
fn insert_inode( &self, path: &Path, ) -> Result<(InodeResolution, Option<InodeResolution>, OsString)>
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§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)