| Copyright | (c) 2024 Illia Shkroba |
|---|---|
| License | BSD3 |
| Maintainer | Illia Shkroba <is@pjwstk.edu.pl> |
| Stability | unstable |
| Portability | non-portable (Non-Unix systems are not supported) |
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
PFile.Mount
Description
Types and functions for mounting filesystem's objects under some "root" directory.
Synopsis
- mount :: (MonadError MountError m, MonadIO m) => Strategy -> Root -> Absolute -> m Mount
- mountPath :: Root -> Absolute -> Mount
- showMountError :: MountError -> Text
- data MountError
- unmount :: (MonadError UnmountError m, MonadIO m) => Root -> Mount -> m Absolute
- originPath :: MonadError OriginResolveError m => Root -> Mount -> m Absolute
- showUnmountError :: UnmountError -> Text
- data UnmountError
- showOriginResolveError :: OriginResolveError -> Text
- data OriginResolveError = OriginOutsideOfRootError !Mount !Root
- newtype Root = Root Absolute
- newtype Mount = Mount {}
Documentation
mount :: (MonadError MountError m, MonadIO m) => Strategy -> Root -> Absolute -> m Mount Source #
Mount a Absolute inside of a Root with a chosen
Strategy for links. mount does the following:
- Moves (renames)
AbsoluteintomountPathunderRoot. If the move fails due to cross-device move attempt, theAbsoluteis copied instead. - Removes
Absoluteat its original location. - Handles links with
handle.
Since: 0.1.0.0
showMountError :: MountError -> Text Source #
data MountError Source #
Error thrown by mount.
Since: 0.1.0.0
Constructors
| OriginMissingError !Absolute !IOException |
|
| LinkHandlingMountError !Error | Error was encountered during |
| OriginLinkRemoveError !RemoveError | Unable to remove |
| OriginMoveError !MoveError | Error was encountered during |
unmount :: (MonadError UnmountError m, MonadIO m) => Root -> Mount -> m Absolute Source #
Unmount a Mount from a Root back to its original location. unmount
does the following:
- Moves (renames)
MountintooriginPathfrom theRoot. If the move fails due to cross-device move attempt, theMountis copied instead. - Removes
Mountat its original location. - Handles links with 'PFile.Profile.LinkHandling.handle PFile.Profile.LinkHandling.CopyLink'.
Since: 0.1.0.0
originPath :: MonadError OriginResolveError m => Root -> Mount -> m Absolute Source #
Origin path of a Mount outside of a Root. originPath is an inverse
of mountPath. Here is an example usage:
>>>r = originPath (Root $ Path.Absolute "/a/b/c/") (Mount $ Path.Absolute "/a/b/c/d/e/f.txt") & runExcept>>>r & either (const False) (== Path.Absolute "/d/e/f.txt")True
originPath works only for Posix paths. Windows paths are not supported
currently.
Since: 0.1.0.0
showUnmountError :: UnmountError -> Text Source #
data UnmountError Source #
Error thrown by unmount.
Since: 0.1.0.0
Constructors
| OriginResolveError !OriginResolveError | Error was encountered during |
| MountMissingError !Absolute !IOException |
|
| LinkHandlingUnmountError !Error | Error was encountered during |
| MountLinkRemoveError !RemoveError | Unable to remove |
| MountMoveError !MoveError | Error was encountered during |
data OriginResolveError Source #
Error thrown by originPath.
Since: 0.1.0.0
Constructors
| OriginOutsideOfRootError !Mount !Root |