pub trait FileSystem: Send + Sync {
    type Handle: Send + Sync + Handle;
    type Reader: Seek + Read + Send;
    type Writer: Seek + Write + Send + WriteExt;

    fn create<P: AsRef<Path>>(&self, path: P) -> Result<Self::Handle>;
    fn open<P: AsRef<Path>>(&self, path: P) -> Result<Self::Handle>;
    fn delete<P: AsRef<Path>>(&self, path: P) -> Result<()>;
    fn rename<P: AsRef<Path>>(&self, src_path: P, dst_path: P) -> Result<()>;
    fn new_reader(&self, handle: Arc<Self::Handle>) -> Result<Self::Reader>;
    fn new_writer(&self, handle: Arc<Self::Handle>) -> Result<Self::Writer>;

    fn reuse<P: AsRef<Path>>(&self, src_path: P, dst_path: P) -> Result<()> { ... }
    fn delete_metadata<P: AsRef<Path>>(&self, _path: P) -> Result<()> { ... }
    fn exists_metadata<P: AsRef<Path>>(&self, _path: P) -> bool { ... }
}
Expand description

FileSystem

Required Associated Types

Required Methods

Provided Methods

Reuses file at src_path as a new file at dst_path. The default implementation simply renames the file.

Deletes user implemented metadata associated with path. Returns true if any metadata is deleted.

In older versions of Raft Engine, physical files are deleted without going through user implemented cleanup procedure. This method is used to detect and cleanup the user metadata that is no longer mapped to a physical file.

Returns whether there is any user metadata associated with given path.

Implementors