Trait flechasdb::io::FileSystem

source ·
pub trait FileSystem {
    type HashedFileOut: HashedFileOut;
    type HashedFileIn: HashedFileIn;

    // Required methods
    fn create_hashed_file(&self) -> Result<Self::HashedFileOut, Error>;
    fn create_hashed_file_in(
        &self,
        path: impl AsRef<str>
    ) -> Result<Self::HashedFileOut, Error>;
    fn open_hashed_file(
        &self,
        path: impl AsRef<str>
    ) -> Result<Self::HashedFileIn, Error>;

    // Provided methods
    fn create_compressed_hashed_file(
        &self
    ) -> Result<CompressedHashedFileOut<Self::HashedFileOut>, Error> { ... }
    fn create_compressed_hashed_file_in(
        &self,
        path: impl AsRef<str>
    ) -> Result<CompressedHashedFileOut<Self::HashedFileOut>, Error> { ... }
    fn open_compressed_hashed_file(
        &self,
        path: impl AsRef<str>
    ) -> Result<CompressedHashedFileIn<Self::HashedFileIn>, Error> { ... }
}
Expand description

Abstracts a file system.

Required Associated Types§

source

type HashedFileOut: HashedFileOut

File that calculates the hash of its contents.

source

type HashedFileIn: HashedFileIn

File whose contents can be verified with the hash.

Required Methods§

source

fn create_hashed_file(&self) -> Result<Self::HashedFileOut, Error>

Creates a file that calculates the hash of its contents.

source

fn create_hashed_file_in( &self, path: impl AsRef<str> ) -> Result<Self::HashedFileOut, Error>

Creates a hashed file in a given directory.

source

fn open_hashed_file( &self, path: impl AsRef<str> ) -> Result<Self::HashedFileIn, Error>

Opens a file whose contents can be verified with a hash.

Provided Methods§

source

fn create_compressed_hashed_file( &self ) -> Result<CompressedHashedFileOut<Self::HashedFileOut>, Error>

Creates a compressed file that calculates the hash of its contents.

source

fn create_compressed_hashed_file_in( &self, path: impl AsRef<str> ) -> Result<CompressedHashedFileOut<Self::HashedFileOut>, Error>

Creates a compressed hashed file in a given directory.

source

fn open_compressed_hashed_file( &self, path: impl AsRef<str> ) -> Result<CompressedHashedFileIn<Self::HashedFileIn>, Error>

Opens a compressed file whose contents can be verified with a hash.

Implementors§