pub struct MockDfsFrontend { /* private fields */ }
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.

Implementations§

source§

impl MockDfsFrontend

source

pub fn checkpoint(&mut self)

Validate that all current expectations for all methods have been satisfied, and discard them.

source

pub fn new() -> MockDfsFrontend

Create a new mock object with no expectations.

This method will not be generated if the real struct already has a new method. However, it will be generated if the struct implements a trait with a new method. The trait’s new method can still be called like <MockX as TraitY>::new

source§

impl MockDfsFrontend

source

pub fn expect_read_dir(&mut self) -> &mut Expectation

Create an Expectation for mocking the read_dir method

source

pub fn expect_metadata(&mut self) -> &mut Expectation

Create an Expectation for mocking the metadata method

source

pub fn expect_remove_file(&mut self) -> &mut Expectation

Create an Expectation for mocking the remove_file method

source

pub fn expect_rename(&mut self) -> &mut Expectation

Create an Expectation for mocking the rename method

source

pub fn expect_set_permissions(&mut self) -> &mut Expectation

Create an Expectation for mocking the set_permissions method

source

pub fn expect_set_owner(&mut self) -> &mut Expectation

Create an Expectation for mocking the set_owner method

source

pub fn expect_create_dir(&mut self) -> &mut Expectation

Create an Expectation for mocking the create_dir method

source

pub fn expect_remove_dir(&mut self) -> &mut Expectation

Create an Expectation for mocking the remove_dir method

source

pub fn expect_stat_fs(&mut self) -> &mut Expectation

Create an Expectation for mocking the stat_fs method

source

pub fn expect_get_receiver(&mut self) -> &mut Expectation

Create an Expectation for mocking the get_receiver method

source

pub fn expect_mount(&mut self) -> &mut Expectation

Create an Expectation for mocking the mount method

source

pub fn expect_get_space_usage(&mut self) -> &mut Expectation

Create an Expectation for mocking the get_space_usage method

source

pub fn expect_is_accessible(&mut self) -> &mut Expectation

Create an Expectation for mocking the is_accessible method

source

pub fn expect_download(&mut self) -> &mut Expectation

Create an Expectation for mocking the download method

source

pub fn expect_upload(&mut self) -> &mut Expectation

Create an Expectation for mocking the upload method

source

pub fn expect_get_path(&mut self) -> &mut Expectation

Create an Expectation for mocking the get_path method

Trait Implementations§

source§

impl Debug for MockDfsFrontend

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl Default for MockDfsFrontend

source§

fn default() -> MockDfsFrontend

Returns the “default value” for a type. Read more
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.
source§

fn read_dir( &self, path: String ) -> Result<Vec<DirEntry, Global>, 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, Global>, progress_reporter: Box<dyn ProgressReporter, Global>, 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, Global>, progress_reporter: Box<dyn ProgressReporter, Global>, 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

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Any for Twhere T: Any,

§

fn into_any(self: Box<T, Global>) -> Box<dyn Any, Global>

§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

§

fn type_name(&self) -> &'static str

§

impl<T> AnySync for Twhere T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more