pub struct Manager { /* private fields */ }Implementations§
Source§impl Manager
impl Manager
pub fn new() -> Result<Self, ManagerInitError>
Sourcepub fn definitions(
&self,
) -> Result<Vec<FilesystemMountDefinition>, SftpManError>
pub fn definitions( &self, ) -> Result<Vec<FilesystemMountDefinition>, SftpManError>
Returns the list of all known (stored in the config directory) filesystem definitions.
Sourcepub fn definition(
&self,
id: &str,
) -> Result<FilesystemMountDefinition, SftpManError>
pub fn definition( &self, id: &str, ) -> Result<FilesystemMountDefinition, SftpManError>
Returns the filesystem definition (as stored in the config directory) for the given ID.
Sourcepub fn full_state(&self) -> Result<Vec<MountState>, SftpManError>
pub fn full_state(&self) -> Result<Vec<MountState>, SftpManError>
Returns the full state (configuration and mount status) of all known (stored in the config directory) filesystem definitions.
Sourcepub fn is_definition_mounted(
&self,
definition: &FilesystemMountDefinition,
) -> Result<bool, SftpManError>
pub fn is_definition_mounted( &self, definition: &FilesystemMountDefinition, ) -> Result<bool, SftpManError>
Tells if the given filesystem definition is currently mounted.
Sourcepub fn mount(
&self,
definition: &FilesystemMountDefinition,
) -> Result<(), SftpManError>
pub fn mount( &self, definition: &FilesystemMountDefinition, ) -> Result<(), SftpManError>
Mounts a filesystem definition unless already mounted.
Sourcepub fn umount(
&self,
definition: &FilesystemMountDefinition,
) -> Result<(), SftpManError>
pub fn umount( &self, definition: &FilesystemMountDefinition, ) -> Result<(), SftpManError>
Unmounts a filesystem definition (unless already unmounted) and removes its mount path from the filesystem hierarchy.
Unmounting is performed via a command call to fusermount -u ..,
which may fail on filesystems that are currently busy.
In such cases, a fallback is performed - the sshfs process responsible for the mount gets terminated.
Sourcepub fn remove(
&self,
definition: &FilesystemMountDefinition,
) -> Result<(), SftpManError>
pub fn remove( &self, definition: &FilesystemMountDefinition, ) -> Result<(), SftpManError>
Unmounts the given filesystem (if mounted) and removes the configuration file for it.
Sourcepub fn preflight_check(&self) -> Result<(), Vec<PreflightCheckError>>
pub fn preflight_check(&self) -> Result<(), Vec<PreflightCheckError>>
Checks if we have everything needed to mount sshfs/SFTP filesystems.
Sourcepub fn persist(
&self,
definition: &FilesystemMountDefinition,
) -> Result<(), SftpManError>
pub fn persist( &self, definition: &FilesystemMountDefinition, ) -> Result<(), SftpManError>
Persists (creates or updates) a filesystem definition.
If the definition already exists, it will be unmounted before persisting and will be remounted after.
Sourcepub fn open(
&self,
definition: &FilesystemMountDefinition,
) -> Result<(), SftpManError>
pub fn open( &self, definition: &FilesystemMountDefinition, ) -> Result<(), SftpManError>
Opens the directory where the given filesystem definition is mounted.