diff options
author | Joey Hess <joeyh@joeyh.name> | 2015-10-09 14:57:32 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2015-10-09 14:57:32 -0400 |
commit | d6831bd8f2bd4e4c518d0779895c990268c17777 (patch) | |
tree | 595f33bf3a8ec7a5ce1a2d026c0f2a9dddece77f /Command/Drop.hs | |
parent | 4f9957f5342c58adf5b406122b6a8157352ab89b (diff) |
verify local copy of content with locking
Diffstat (limited to 'Command/Drop.hs')
-rw-r--r-- | Command/Drop.hs | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/Command/Drop.hs b/Command/Drop.hs index 43dc51d74..a2bca2204 100644 --- a/Command/Drop.hs +++ b/Command/Drop.hs @@ -97,12 +97,9 @@ startRemote afile numcopies key remote = do -- sees the key is present on the other. performLocal :: Key -> AssociatedFile -> NumCopies -> [VerifiedCopy] -> CommandPerform performLocal key afile numcopies preverified = lockContentExclusive key $ \contentlock -> do - (remotes, trusteduuids) <- Remote.keyPossibilitiesTrusted key - let preverified' = preverified ++ map (mkVerifiedCopy TrustedCopy) trusteduuids - untrusteduuids <- trustGet UnTrusted - let tocheck = Remote.remotesWithoutUUID remotes (map toUUID preverified'++untrusteduuids) u <- getUUID - doDrop u key afile numcopies [] preverified' tocheck + (tocheck, verified) <- verifiableCopies key [u] + doDrop u key afile numcopies [] (preverified ++ verified) tocheck ( \proof -> do liftIO $ debugM "drop" $ unwords [ "Dropping from here" @@ -123,13 +120,8 @@ performRemote key afile numcopies remote = do -- places assumed to have the key, and places to check. -- When the local repo has the key, that's one additional copy, -- as long as the local repo is not untrusted. - (remotes, trusteduuids) <- knownCopies key - let trusted = filter (/= uuid) trusteduuids - let preverified = map (mkVerifiedCopy TrustedCopy) trusted - untrusteduuids <- trustGet UnTrusted - let tocheck = filter (/= remote) $ - Remote.remotesWithoutUUID remotes (trusted++untrusteduuids) - doDrop uuid key afile numcopies [uuid] preverified tocheck + (tocheck, verified) <- verifiableCopies key [uuid] + doDrop uuid key afile numcopies [uuid] verified tocheck ( \proof -> do liftIO $ debugM "drop" $ unwords [ "Dropping from remote" @@ -165,7 +157,16 @@ cleanupRemote key remote ok = do - - --force overrides and always allows dropping. -} -doDrop :: UUID -> Key -> AssociatedFile -> NumCopies -> [UUID] -> [VerifiedCopy] -> [Remote] -> (Maybe SafeDropProof -> CommandPerform, CommandPerform) -> CommandPerform +doDrop + :: UUID + -> Key + -> AssociatedFile + -> NumCopies + -> [UUID] + -> [VerifiedCopy] + -> [UnVerifiedCopy] + -> (Maybe SafeDropProof -> CommandPerform, CommandPerform) + -> CommandPerform doDrop dropfrom key afile numcopies skip preverified check (dropaction, nodropaction) = ifM (Annex.getState Annex.force) ( dropaction Nothing |