Skip to main content

FileStore

Trait FileStore 

Source
pub trait FileStore {
    // Required methods
    fn get_native_path<P: AsRef<Utf8Path>>(&self, path: P) -> Utf8PathBuf;
    fn create_directory<P: AsRef<Utf8Path>>(
        &self,
        path: P,
    ) -> FileStoreResult<()>;
    fn remove_directory<P: AsRef<Utf8Path>>(
        &self,
        path: P,
    ) -> FileStoreResult<()>;
    fn create_file<P: AsRef<Utf8Path>>(&self, path: P) -> FileStoreResult<()>;
    fn delete_file<P: AsRef<Utf8Path>>(&self, path: P) -> FileStoreResult<()>;
    fn open<P: AsRef<Utf8Path>>(
        &self,
        path: P,
        options: &mut OpenOptions,
    ) -> FileStoreResult<File>;
    fn open_tempfile(&self) -> FileStoreResult<File>;
    fn get_size<P: AsRef<Utf8Path>>(&self, path: P) -> FileStoreResult<u64>;
}
Expand description

Defines any necessary actions a CFDP File Store implementation must perform. Assumes any FileStore has a root path it operates relative to.

Required Methods§

Source

fn get_native_path<P: AsRef<Utf8Path>>(&self, path: P) -> Utf8PathBuf

Returns the path to the target with the root path prepended. Used when manipulating the filesystem relative to the root path.

Source

fn create_directory<P: AsRef<Utf8Path>>(&self, path: P) -> FileStoreResult<()>

Creates the directory Relative to the root path.

Source

fn remove_directory<P: AsRef<Utf8Path>>(&self, path: P) -> FileStoreResult<()>

Remove a directory Relative to the root path.

Source

fn create_file<P: AsRef<Utf8Path>>(&self, path: P) -> FileStoreResult<()>

Creates a file relative to the root path.

Source

fn delete_file<P: AsRef<Utf8Path>>(&self, path: P) -> FileStoreResult<()>

Delete a file relative to the root path.

Source

fn open<P: AsRef<Utf8Path>>( &self, path: P, options: &mut OpenOptions, ) -> FileStoreResult<File>

Opens a file relative to the root path with the given options.

Source

fn open_tempfile(&self) -> FileStoreResult<File>

Opens a system temporary file

Source

fn get_size<P: AsRef<Utf8Path>>(&self, path: P) -> FileStoreResult<u64>

Retuns the size of the file on disk relative to the root path.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§