charon-0.1: Template
Safe HaskellSafe-Inferred
LanguageGHC2021

Charon.Backend.Cbor

Description

The Cbor backend.

Synopsis

Delete

delete :: forall env m. (HasCallStack, HasTrashHome env, MonadAsync m, MonadCatch m, MonadFileWriter m, MonadIORef m, MonadLoggerNS m, MonadPathReader m, MonadPathWriter m, MonadPosixCompat m, MonadReader env m, MonadTerminal m, MonadTime m) => UniqueSeqNE (PathI TrashEntryOriginalPath) -> m () Source #

delete trash p moves path p to the given trash location trash and writes an entry in the trash index. If the trash location is not given, defaults to XDG data e.g. ~/.localsharecharon/.

Restore

restore :: forall env m. (HasCallStack, HasTrashHome env, MonadAsync m, MonadCatch m, MonadIORef m, MonadFileReader m, MonadLoggerNS m, MonadPathReader m, MonadPathWriter m, MonadPosixCompat m, MonadReader env m, MonadTerminal m) => UniqueSeqNE (PathI TrashEntryFileName) -> m () Source #

restore trash p restores the trashed path <trash>/p to its original location.

Information

getIndex :: forall env m. (HasCallStack, HasTrashHome env, MonadAsync m, MonadCatch m, MonadFileReader m, MonadPathReader m, MonadLoggerNS m, MonadReader env m, MonadPosixCompat m, MonadTerminal m) => m Index Source #

Reads the index at either the specified or default location. If the file does not exist, returns empty.

getMetadata :: forall m env. (HasCallStack, HasTrashHome env, MonadAsync m, MonadCatch m, MonadFileReader m, MonadLoggerNS m, MonadPathReader m, MonadPosixCompat m, MonadReader env m, MonadTerminal m) => m Metadata Source #

Retrieves metadata for the trash directory.

Transformations

Rosetta

Existence

isCbor :: (HasCallStack, MonadCatch m, MonadLoggerNS m, MonadPathReader m) => PathI TrashHome -> m (Maybe Bool) Source #

Determines if the backend is Cbor. The semantics are if the trash is a well-formed cbor backend and it has at least one file with the extension .cbor, then we return Just True (definitely true).

If the trash does not exist or is not well-formed, we return Just False (definitely false).

If the trash is a well-formed cbor backend but we do not have any files we return Nothing (maybe), because we cannot tell. It could be any backend that shares the same trash structure, including cbor.