make removeKey throw exceptions

This commit is contained in:
Joey Hess 2020-05-14 14:08:09 -04:00
parent b5ee97f32a
commit 4be94c67c7
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
28 changed files with 134 additions and 111 deletions

View file

@ -97,12 +97,14 @@ data RemoteA a = Remote
, retrieveKeyFileCheap :: Maybe (Key -> AssociatedFile -> FilePath -> a ())
-- Security policy for reteiving keys from this remote.
, retrievalSecurityPolicy :: RetrievalSecurityPolicy
-- Removes a key's contents (succeeds if the contents are not present)
, removeKey :: Key -> a Bool
-- Removes a key's contents (succeeds even the contents are not present)
-- Can throw exception if unable to access remote, or if remote
-- refuses to remove the content.
, removeKey :: Key -> a ()
-- Uses locking to prevent removal of a key's contents,
-- thus producing a VerifiedCopy, which is passed to the callback.
-- If unable to lock, does not run the callback, and throws an
-- error.
-- exception.
-- This is optional; remotes do not have to support locking.
, lockContent :: forall r. Maybe (Key -> (VerifiedCopy -> a r) -> a r)
-- Checks if a key is present in the remote.

View file

@ -31,8 +31,9 @@ type Storer = Key -> ContentSource -> MeterUpdate -> Annex ()
type Retriever = Key -> MeterUpdate -> (ContentSource -> Annex ()) -> Annex ()
-- Action that removes a Key's content from a remote.
-- Succeeds if key is already not present; never throws exceptions.
type Remover = Key -> Annex Bool
-- Succeeds if key is already not present.
-- Throws an exception if the remote is not accessible.
type Remover = Key -> Annex ()
-- Checks if a Key's content is present on a remote.
-- Throws an exception if the remote is not accessible.