pub trait DfsFrontend: Send + Sync {
Show 16 methods // Required methods fn read_dir(&self, path: String) -> Result<Vec<DirEntry>, DfsFrontendError>; fn metadata(&self, path: String) -> Result<NodeStat, DfsFrontendError>; fn remove_file(&self, path: String) -> Result<(), DfsFrontendError>; fn rename( &self, old_path: String, new_path: String ) -> Result<(), DfsFrontendError>; fn set_permissions( &self, path: String, permissions: WlPermissions ) -> Result<(), DfsFrontendError>; fn set_owner(&self, path: String) -> Result<(), DfsFrontendError>; fn create_dir(&self, path: String) -> Result<(), DfsFrontendError>; fn remove_dir( &self, path: String, is_recursive: bool ) -> Result<(), DfsFrontendError>; fn stat_fs(&self, path: String) -> Result<FsStat, DfsFrontendError>; fn get_receiver(&self) -> Arc<Mutex<dyn EventReceiver>>; fn mount(&self, storage: &Storage) -> Result<(), DfsFrontendError>; fn get_space_usage( &self, storage: &Storage ) -> Result<SpaceUsage, DfsFrontendError>; fn is_accessible(&self, storage: &Storage) -> Result<bool, DfsFrontendError>; fn download( &self, path: String, output: Box<dyn OStream>, progress_reporter: Box<dyn ProgressReporter>, abort_flag: &AbortFlag ) -> Result<(), DfsFrontendError>; fn upload( &self, path: String, input: Box<dyn IStream>, progress_reporter: Box<dyn ProgressReporter>, abort_flag: &AbortFlag, creation_time: Option<UnixTimestamp> ) -> Result<(), DfsFrontendError>; fn get_path(&self, identifier: String) -> Result<String, DfsFrontendError>;
}
Expand description

Interface that DFS exposes towards filesystem-like frontend providers

DFS methods may return error that are not related with particular operation but rather with wildland system in general. Those errors could be:

  • PathResolutionError - happens when path resolving failed, e.g. due to the catlib error.
  • StorageNotResponsive - happens when none of storages that operation involves returns an answer.
  • Generic - unanticipated errors.

Required Methods§

source

fn read_dir(&self, path: String) -> Result<Vec<DirEntry>, DfsFrontendError>

Returns vector of entries found under the provided path. It may merge entries from multiple containers.

Errors:
  • NotADirectory - for paths that don’t represent directories
  • NoSuchPath - requested path does not exist
source

fn metadata(&self, path: String) -> Result<NodeStat, DfsFrontendError>

Returns metadata of a node.

Errors:
  • NoSuchPath - requested path does not exist
source

fn remove_file(&self, path: String) -> Result<(), DfsFrontendError>

Removes a file

Errors:
  • NoSuchPath - requested path does not exist
  • NotAFile - provided path represents a node that is not a file
source

fn rename( &self, old_path: String, new_path: String ) -> Result<(), DfsFrontendError>

Rename a file or directory to a new path, if new path does not exist yet. In contrast to POSIX-like rename operation, it returns error in case of new path existence in all cases, so it is up to a caller whether to remove a node under new path or not.

Errors:

NoSuchPath - source not found SourceIsParentOfTarget - new directory would be a subdirectory of itself MoveBetweenContainers - new_path is in different Container than old_path PathAlreadyExists - new_path already exists

source

fn set_permissions( &self, path: String, permissions: WlPermissions ) -> Result<(), DfsFrontendError>

Changes the permissions of the underlying file.

source

fn set_owner(&self, path: String) -> Result<(), DfsFrontendError>

Not supported yet - it always returns DfsFrontendError::Generic(_)

source

fn create_dir(&self, path: String) -> Result<(), DfsFrontendError>

Creates a new, empty directory at the provided path

Errors:

InvalidParent - a parent of the given path doesn’t exist. PathAlreadyExists - path already exists.

source

fn remove_dir( &self, path: String, is_recursive: bool ) -> Result<(), DfsFrontendError>

Removes a directory If is_recursive is set to true, it will remove all the children of the directory

Errors:

NotADirectory - path does not represent a directory NoSuchPath - no such path exists DirNotEmpty - directory is not empty

source

fn stat_fs(&self, path: String) -> Result<FsStat, DfsFrontendError>

Returns information about a mounted filesystem. Path is the pathname of any file within the mounted filesystem.

Errors:

NoSuchPath - no such path exists

source

fn get_receiver(&self) -> Arc<Mutex<dyn EventReceiver>>

Returns receiver that can listen to DFS events. Events may be split between different EventReceiver.

source

fn mount(&self, storage: &Storage) -> Result<(), DfsFrontendError>

Attempts to mount given Storage. This method’s state should not be considered emphemeral.

This functionality may be used during container mount to ensure storage being healthy, before any FS operations are performed.

source

fn get_space_usage( &self, storage: &Storage ) -> Result<SpaceUsage, DfsFrontendError>

Returns (used, total) space in bytes

source

fn is_accessible(&self, storage: &Storage) -> Result<bool, DfsFrontendError>

Checks whether the Storage is accessible

source

fn download( &self, path: String, output: Box<dyn OStream>, progress_reporter: Box<dyn ProgressReporter>, abort_flag: &AbortFlag ) -> Result<(), DfsFrontendError>

Downloads a file and writes it to the provided output stream

source

fn upload( &self, path: String, input: Box<dyn IStream>, progress_reporter: Box<dyn ProgressReporter>, abort_flag: &AbortFlag, creation_time: Option<UnixTimestamp> ) -> Result<(), DfsFrontendError>

Reads a file from the provided input stream and uploads it to the backend

source

fn get_path(&self, identifier: String) -> Result<String, DfsFrontendError>

Finds path of object which matches the uuid

Implementors§

source§

impl DfsFrontend for MockDfsFrontend

Interface that DFS exposes towards filesystem-like frontend providers

DFS methods may return error that are not related with particular operation but rather with wildland system in general. Those errors could be:

  • PathResolutionError - happens when path resolving failed, e.g. due to the catlib error.
  • StorageNotResponsive - happens when none of storages that operation involves returns an answer.
  • Generic - unanticipated errors.