pub struct FileSystem<P: CheckedPermissions> { /* private fields */ }Expand description
Implementations§
Source§impl<P: CheckedPermissions> FileSystem<P>
impl<P: CheckedPermissions> FileSystem<P>
pub fn open_file( &self, path: impl Into<String>, location: Location, flags: OpenFlags, ) -> Result<File<P>, Error>
pub fn open_dir( &self, path: impl Into<String>, location: Location, ) -> Result<Dir<P>, Error>
pub fn create_dir( &self, path: impl Into<String>, location: Location, ) -> Result<Dir<P>, Error>
pub fn create_dir_async( &self, path: impl Into<String>, location: Location, ) -> Result<CreateDirMessage, Error>
pub fn ensure_parent_dir_exists( &self, path: &str, location: Location, ) -> Result<(), Error>
pub fn remove(
&self,
path: impl Into<String>,
location: Location,
) -> Result<(), Error>where
P: MessageAllowed<Remove>,
pub fn remove_async(
&self,
path: impl Into<String>,
location: Location,
) -> Result<Remove, Error>where
P: MessageAllowed<Remove>,
Sourcepub fn atomic_copy(
&self,
src: impl Into<String>,
dest_dir: impl Into<String>,
rename: Option<impl Into<String>>,
location: Location,
) -> Result<(), Error>where
P: MessageAllowed<AtomicCopy>,
pub fn atomic_copy(
&self,
src: impl Into<String>,
dest_dir: impl Into<String>,
rename: Option<impl Into<String>>,
location: Location,
) -> Result<(), Error>where
P: MessageAllowed<AtomicCopy>,
Copy a source file/directory to a destination directory. If source is a directory, the copy is recursive.
Optionally, the copied file/directory can be renamed by providing the rename argument.
The destination directory must be empty; copying into a non-empty directory returns
Error::FileAlreadyExists.
pub fn metadata(
&self,
path: impl Into<String>,
location: Location,
) -> Result<Metadata, Error>where
P: MessageAllowed<GetMetadata>,
pub fn rename(
&self,
from: impl Into<String>,
to: impl Into<String>,
location: Location,
) -> Result<(), Error>where
P: MessageAllowed<Rename>,
pub fn rename_async(
&self,
from: impl Into<String>,
to: impl Into<String>,
location: Location,
) -> Result<Rename, Error>where
P: MessageAllowed<Rename>,
Sourcepub fn durable_file_write(
&self,
path: &str,
location: Location,
data: &[u8],
) -> Result<(), Error>where
P: DurableFilePermissions,
pub fn durable_file_write(
&self,
path: &str,
location: Location,
data: &[u8],
) -> Result<(), Error>where
P: DurableFilePermissions,
Replace the contents of path with data, so that a crash at any point during the
write leaves FileSystem::durable_file_read either the complete old contents or
the complete new ones.
<path>.tmp and <path>.new belong to this file and must not be used for anything
else. Parent directories must already exist.
Sourcepub fn durable_file_read(
&self,
path: &str,
location: Location,
) -> Result<Vec<u8>, Error>where
P: DurableFilePermissions,
pub fn durable_file_read(
&self,
path: &str,
location: Location,
) -> Result<Vec<u8>, Error>where
P: DurableFilePermissions,
Read a file written by FileSystem::durable_file_write.
§Errors
Error::FileNotFound if no generation of the file exists.
pub fn map_file(
&self,
location: Location,
path: impl Into<String>,
) -> Result<MemoryRange, Error>where
P: MapFilePermissions,
pub fn register_app_resources(
&self,
app_id: AppId,
root: AppResourcesRoot,
app_dir: impl Into<String>,
) -> Result<(), Error>where
P: MessageAllowed<RegisterAppResources>,
Sourcepub fn remove_app_data(&self, app_id: AppId) -> Result<(), Error>where
P: MessageAllowed<RemoveAppData>,
pub fn remove_app_data(&self, app_id: AppId) -> Result<(), Error>where
P: MessageAllowed<RemoveAppData>,
Remove all AppData belonging to app_id, not just the caller’s own. Wipes
the app’s persisted data (including any stored seed) so it does not survive a
reinstall.
pub fn read_blocks(
&mut self,
location: Location,
block_index: u32,
block_count: usize,
buf: MemoryRange,
) -> Result<usize, Error>where
P: MessageAllowed<ReadBlocks>,
pub fn write_blocks(
&mut self,
location: Location,
block_index: u32,
block_count: usize,
buf: MemoryRange,
) -> Result<usize, Error>where
P: MessageAllowed<WriteBlocks>,
pub fn flush(&mut self, location: Location) -> Result<(), Error>where
P: MessageAllowed<FlushFs>,
pub fn block_count(&self, location: Location) -> Result<usize, Error>where
P: MessageAllowed<BlockCount>,
pub fn format_encrypted_volume(&self)where
P: MessageAllowed<FormatEncryptedVolume>,
pub fn subscribe_filesystem_events<S>( &self, listener: &mut ServerContext<S>, location: Location, )
pub fn wait_for_filesystem(&self, location: Location)where
P: 'static + MessageAllowed<SubscribeFilesystemEvent>,
pub fn mount_airlock(&mut self) -> Result<(), Error>where
P: MessageAllowed<MountAirlock>,
pub fn unmount_airlock(&mut self) -> Result<(), Error>where
P: MessageAllowed<MountAirlock>,
pub fn format_airlock(&mut self) -> Result<(), Error>where
P: MessageAllowed<FormatAirlock>,
Trait Implementations§
Source§impl<P: Clone + CheckedPermissions> Clone for FileSystem<P>
impl<P: Clone + CheckedPermissions> Clone for FileSystem<P>
Source§fn clone(&self) -> FileSystem<P>
fn clone(&self) -> FileSystem<P>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more