pub trait FsAdapter {
type File: FileAdapter<Self::Permissions>;
type Permissions: CheckedPermissions;
type DirIter: Iterator<Item = Result<DirEntry, Error>>;
// Required methods
fn create_dir(&self, path: &str, location: Location) -> Result<(), Error>
where Self::Permissions: MessageAllowed<CreateDirMessage> + MessageAllowed<CloseDir>;
fn remove(&self, path: &str, location: Location) -> Result<(), Error>
where Self::Permissions: MessageAllowed<Remove>;
fn atomic_copy(
&self,
src: &str,
dest: &str,
rename: Option<String>,
location: Location,
) -> Result<(), Error>
where Self::Permissions: MessageAllowed<AtomicCopy>;
fn open_file(
&self,
path: &str,
location: Location,
flags: OpenFlags,
) -> Result<Self::File, Error>
where Self::Permissions: MessageAllowed<OpenFileMessage> + MessageAllowed<CloseFile>;
fn open_dir(
&self,
path: &str,
location: Location,
) -> Result<Self::DirIter, Error>
where Self::Permissions: MessageAllowed<OpenDirMessage> + MessageAllowed<CloseDir> + MessageAllowed<NextEntry>;
fn metadata(
&self,
path: &str,
location: Location,
) -> Result<Metadata, Error>
where Self::Permissions: MessageAllowed<GetMetadata>;
fn rename(
&self,
src: &str,
dest: &str,
location: Location,
) -> Result<(), Error>
where Self::Permissions: MessageAllowed<Rename>;
fn flush(&mut self, location: Location) -> Result<(), Error>
where Self::Permissions: MessageAllowed<FlushFs>;
// Provided methods
fn walk_dir(
&self,
path: &str,
location: Location,
) -> Result<DirWalker<Self>, Error>
where Self: Clone,
Self::Permissions: MessageAllowed<OpenDirMessage> + MessageAllowed<CloseDir> + MessageAllowed<NextEntry> { ... }
fn ensure_parent_dir_exists(
&self,
path: &str,
location: Location,
) -> Result<(), Error>
where Self::Permissions: MessageAllowed<CreateDirMessage> + MessageAllowed<CloseDir> { ... }
fn remove_if_exists(
&self,
path: &str,
location: Location,
) -> Result<(), Error>
where Self::Permissions: MessageAllowed<Remove> { ... }
}Expand description
Abstraction over filesystem operations for testing and generic code.
FileSystem: actual keyos fs serverFsTest: uses temporary directories (test-only)