summaryrefslogtreecommitdiff
path: root/Annex/NumCopies.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2015-10-09 12:36:04 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2015-10-09 12:36:04 -0400
commit7788d302397096c85fe70c35f2661d76a8d2f511 (patch)
treebe835fdaab4fb0abdb751fb856d7b00d5c4b86fa /Annex/NumCopies.hs
parent00ba3ec15d8e3a51545aed4c6e43771f2630a0f8 (diff)
finish and use lockContent interface
Diffstat (limited to 'Annex/NumCopies.hs')
-rw-r--r--Annex/NumCopies.hs19
1 files changed, 13 insertions, 6 deletions
diff --git a/Annex/NumCopies.hs b/Annex/NumCopies.hs
index 6c069c763..7874fb0e9 100644
--- a/Annex/NumCopies.hs
+++ b/Annex/NumCopies.hs
@@ -26,6 +26,7 @@ import Logs.NumCopies
import Logs.Trust
import Annex.CheckAttr
import qualified Remote
+import qualified Types.Remote as Remote
import Annex.UUID
import Annex.Content
@@ -122,12 +123,18 @@ verifyEnoughCopiesToDrop nolocmsg key need skip preverified tocheck dropaction n
case p of
Right proof -> dropaction proof
Left stillhave -> helper bad missing stillhave (r:rs)
- | otherwise = do
- haskey <- Remote.hasKey r key
- case haskey of
- Right True -> helper bad missing (mkVerifiedCopy RecentlyVerifiedCopy r : have) rs
- Left _ -> helper (r:bad) missing have rs
- Right False -> helper bad (Remote.uuid r:missing) have rs
+ | otherwise = case Remote.lockContent r of
+ Nothing -> fallback
+ Just lockcontent -> lockcontent key $ \v -> case v of
+ Nothing -> fallback
+ Just vc -> helper bad missing (vc : have) rs
+ where
+ fallback = do
+ haskey <- Remote.hasKey r key
+ case haskey of
+ Right True -> helper bad missing (mkVerifiedCopy RecentlyVerifiedCopy r : have) rs
+ Left _ -> helper (r:bad) missing have rs
+ Right False -> helper bad (Remote.uuid r:missing) have rs
notEnoughCopies :: Key -> NumCopies -> [VerifiedCopy] -> [UUID] -> [Remote] -> String -> Annex ()
notEnoughCopies key need have skip bad nolocmsg = do