pfile-0.1.0.1: CLI program for profiles management.
Copyright(c) 2024 Illia Shkroba
LicenseBSD3
MaintainerIllia Shkroba <[email protected]>
Stabilityunstable
Portabilitynon-portable (Non-Unix systems are not supported)
Safe HaskellSafe-Inferred
LanguageHaskell2010

PFile.Profile.Internal.Switch

Description

Types and functions for profiles switching.

Synopsis

Documentation

switch Source #

Arguments

:: (MonadError SwitchError m, MonadIO m) 
=> SwitchOptions

Options that control switch behaviour (currently only forceRemoveOccupied).

-> Profile

Current profile.

-> Profile

Next profile.

-> m () 

Switch from the current profile to the next profile. switch unlinks the current profile and then links the next profile.

Since: 0.1.0.0

unlink :: (MonadError UnlinkError m, MonadIO m) => SwitchOptions -> Profile -> m () Source #

Remove links pointing at entries inside of the Profile. unlink only remove links that are know to PFile.

Since: 0.1.0.0

validateLinkedEntry :: (MonadError LinkedEntryValidateError m, MonadIO m) => Entry -> m () Source #

Validate that Entrys originPath is a link pointing at mountPath.

Since: 0.1.0.0

link :: forall m. (MonadError LinkError m, MonadIO m) => SwitchOptions -> Profile -> m () Source #

Create links pointing at Entryies inside of the Profile with linkAll.

Since: 0.1.0.0

unpack :: forall m. (MonadError UnpackError m, MonadIO m) => SwitchOptions -> Profile -> m () Source #

Unpack Profiles entries back to their original locations with unpackAll.

Since: 0.1.0.0

validateUnlinkedEntry :: (MonadError UnlinkedEntryValidateError m, MonadIO m) => Entry -> m () Source #

Validate that Entrys originPath does not exist.

Since: 0.1.0.0

purge :: forall m. (MonadError PurgeError m, MonadIO m) => Profile -> m () Source #

Forcibly remove originPaths of a Profiles Entryies.

Since: 0.1.0.0

data SwitchError Source #

Error thrown by switch.

Since: 0.1.0.0

Constructors

UnlinkCurrentError !UnlinkError

Error was encountered during unlink.

LinkNextError !LinkError

Error was encountered during link.

data UnlinkError Source #

Error thrown by unlink.

Since: 0.1.0.0

Constructors

ValidateUnlinkError !LinkedEntryValidateError

Validation error of entries was encountered.

PurgeUnlinkError !PurgeError

Error was encountered during purge.

data LinkError Source #

Error thrown by link.

Since: 0.1.0.0

Constructors

PurgeLinkError !PurgeError

Error was encountered during purge.

ValidateLinkError !UnlinkedEntryValidateError

Validation error of entries was encountered.

LinkRollbackError

link attempted to rollback due to LinkError. The rollback has failed with a list of RemoveErrors. Since the rollback has failed, the profile passed to link was partially linked - some links were created and should be removed manually.

Fields

LinkError !LinkError

link attempted to rollback due to LinkError. The rollback has succeeded. The profile passed to link was not linked.

data UnpackError Source #

Error thrown by unpack.

Since: 0.1.0.0

Constructors

PurgeUnpackError !PurgeError

Error was encountered during purge.

UnlinkUnpackError !UnlinkError

Error was encountered during unlink.

UnpackRollbackError

unpack attempted to rollback due to UnpackError. The rollback has failed with a list of RemoveErrors. Since the rollback has failed, the profile passed to unpack was partially unpacked - some entries were unpacked and should be removed manually.

Fields

UnpackError !UnpackError 

newtype UnlinkedEntryValidateError Source #

Error thrown by validateUnlinkedEntry.

Since: 0.1.0.0

Constructors

OriginOccupiedError Entry

Entrys originPath is occupied.

data PurgeError Source #

Error thrown by purge.

Since: 0.1.0.0

Constructors

TrashCanCreateError !CreateError

Error was encountered during create.

TrashError !TrashError

Error was encountered during trash.

PurgeRollbackError

purge attempted to rollback due to PurgeError. The rollback has failed with a list of RestoreEntryErrors. Since the rollback has failed, the trashed entries of the Profile are still kept inside of the TrashCan.

Fields

TrashCanRemoveError !RemoveError

Error was encountered during remove.

newtype SwitchOptions Source #

switch options.

Since: 0.1.0.0

Constructors

SwitchOptions 

Fields