diff options
author | Joey Hess <joeyh@joeyh.name> | 2015-10-09 15:01:16 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2015-10-09 15:01:33 -0400 |
commit | 25fe225df2f6edd79ad0bbbbcbfcc72e736b6a17 (patch) | |
tree | cf35748a5cfad45e490ea35cede6f6375359be84 | |
parent | d6831bd8f2bd4e4c518d0779895c990268c17777 (diff) |
rename constructor
-rw-r--r-- | Annex/Content.hs | 2 | ||||
-rw-r--r-- | Command/Import.hs | 2 | ||||
-rw-r--r-- | Types/NumCopies.hs | 14 |
3 files changed, 8 insertions, 10 deletions
diff --git a/Annex/Content.hs b/Annex/Content.hs index da29aa4ed..40c78fd34 100644 --- a/Annex/Content.hs +++ b/Annex/Content.hs @@ -183,7 +183,7 @@ contentLockFile key = Just <$> calcRepo (gitAnnexContentLock key) lockContentShared :: Key -> (VerifiedCopy -> Annex a) -> Annex a lockContentShared key a = lockContentUsing lock key $ do u <- getUUID - withVerifiedCopy VerifiedCopyLock u a + withVerifiedCopy LockedCopy u a where #ifndef mingw32_HOST_OS lock contentfile Nothing = liftIO $ tryLockShared Nothing contentfile diff --git a/Command/Import.hs b/Command/Import.hs index 313339371..5ac050351 100644 --- a/Command/Import.hs +++ b/Command/Import.hs @@ -19,8 +19,6 @@ import Types.KeySource import Types.Key import Annex.CheckIgnore import Annex.NumCopies -import Types.TrustLevel -import Logs.Trust cmd :: Command cmd = withGlobalOptions fileMatchingOptions $ notBareRepo $ diff --git a/Types/NumCopies.hs b/Types/NumCopies.hs index 17080cf7c..bbd1b3831 100644 --- a/Types/NumCopies.hs +++ b/Types/NumCopies.hs @@ -49,7 +49,7 @@ data VerifiedCopy - Until its associated action is called to unlock it, - the copy is locked in the repository and is guaranteed - not to be dropped by any git-annex process. -} - | VerifiedCopyLock V + | LockedCopy V deriving (Show) data V = V @@ -67,7 +67,7 @@ instance ToUUID VerifiedCopy where toV :: VerifiedCopy -> V toV (TrustedCopy v) = v toV (RecentlyVerifiedCopy v) = v -toV (VerifiedCopyLock v) = v +toV (LockedCopy v) = v -- Checks that it's still valid. checkVerifiedCopy :: VerifiedCopy -> IO Bool @@ -77,8 +77,8 @@ invalidateVerifiedCopy :: VerifiedCopy -> IO () invalidateVerifiedCopy = _invalidateVerifiedCopy . toV strongestVerifiedCopy :: VerifiedCopy -> VerifiedCopy -> VerifiedCopy -strongestVerifiedCopy a@(VerifiedCopyLock _) _ = a -strongestVerifiedCopy _ b@(VerifiedCopyLock _) = b +strongestVerifiedCopy a@(LockedCopy _) _ = a +strongestVerifiedCopy _ b@(LockedCopy _) = b strongestVerifiedCopy a@(TrustedCopy _) _ = a strongestVerifiedCopy _ b@(TrustedCopy _) = b strongestVerifiedCopy a@(RecentlyVerifiedCopy _) _ = a @@ -116,8 +116,8 @@ withVerifiedCopy mk u = bracketIO setup cleanup {- Check whether enough verification has been done of copies to allow - dropping content safely. - - - Unless numcopies is 0, at least one VerifiedCopyLock or TrustedCopy - - is required. A VerifiedCopyLock prevents races between concurrent + - Unless numcopies is 0, at least one LockedCopy or TrustedCopy + - is required. A LockedCopy prevents races between concurrent - drops from dropping the last copy, no matter what. - - The other N-1 copies can be less strong verifications, like @@ -132,7 +132,7 @@ isSafeDrop (NumCopies n) l | otherwise = length (deDupVerifiedCopies l) >= n && any fullVerification l fullVerification :: VerifiedCopy -> Bool -fullVerification (VerifiedCopyLock _) = True +fullVerification (LockedCopy _) = True fullVerification (TrustedCopy _) = True fullVerification (RecentlyVerifiedCopy _) = False |