Trait FileSystem

Source
pub trait FileSystem {
    type FileSystemImpl: FileSystem;

    // Required methods
    fn new(uri: &Iri<'_>, conf: &Configuration) -> Result<Self::FileSystemImpl>;
    fn resolve_symlinks(&self) -> bool;
    fn get_uri(&self) -> Iri<'_>;
    fn get_home_directory(&self) -> Result<Path>;
    fn get_working_directory(&self) -> &Path;
    fn mkdirs(
        &self,
        f: &Path,
        permission: Option<&FsPermission>,
    ) -> Result<bool>;

    // Provided methods
    fn get_resolve_symlinks(conf: &Configuration) -> bool { ... }
    fn get_default_uri(conf: &Configuration) -> Result<Iri<'_>> { ... }
    fn get_scheme(&self) -> Result<&str> { ... }
    fn fix_relative_part(&self, p: &Path) -> Result<Path> { ... }
}
Expand description

An abstract base class for a fairly generic filesystem. It may be implemented as a distributed filesystem, or as a “local” one that reflects the locally-connected disk. The local version exists for small Hadoop instances and for testing.

Required Associated Types§

Required Methods§

Source

fn new(uri: &Iri<'_>, conf: &Configuration) -> Result<Self::FileSystemImpl>

Should symbolic links be resolved by FileSystemLinkResolver.

Source

fn get_uri(&self) -> Iri<'_>

Returns a URI which identifies this FileSystem.

Source

fn get_home_directory(&self) -> Result<Path>

Return the current user’s home directory in this FileSystem. The default implementation returns "/user/$USER/".

Source

fn get_working_directory(&self) -> &Path

Get the current working directory for the given FileSystem

Source

fn mkdirs(&self, f: &Path, permission: Option<&FsPermission>) -> Result<bool>

Make the given file and all non-existent parents into directories. Has roughly the semantics of Unix mkdir -p. Existence of the directory hierarchy is not an error.

Provided Methods§

Source

fn get_default_uri(conf: &Configuration) -> Result<Iri<'_>>

Get the default FileSystem URI from a configuration.

Source

fn get_scheme(&self) -> Result<&str>

Return the protocol scheme for this FileSystem.

Source

fn fix_relative_part(&self, p: &Path) -> Result<Path>

See [FileContext#fix_relative_part]

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§