summaryrefslogtreecommitdiff
path: root/Types/NumCopies.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2015-10-08 18:32:31 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2015-10-08 18:34:48 -0400
commit9b613b4275987d2a5424c8995b304e2a45e9cc66 (patch)
tree621f39c1fd54073a80064db1a16734b1de10e126 /Types/NumCopies.hs
parent51b93b1606bac86ffc66d4cf3a457888a6800778 (diff)
TrustedCopy is good enough to allow dropping
By definition, a trusted repository is trusted to always have its location tracking log accurate. Thus, it should never be in a position where content is being dropped from it concurrently, as that would result in the location tracking log not being accurate.
Diffstat (limited to 'Types/NumCopies.hs')
-rw-r--r--Types/NumCopies.hs15
1 files changed, 7 insertions, 8 deletions
diff --git a/Types/NumCopies.hs b/Types/NumCopies.hs
index 0acb7cc3b..1a3b973cc 100644
--- a/Types/NumCopies.hs
+++ b/Types/NumCopies.hs
@@ -30,14 +30,13 @@ fromNumCopies (NumCopies n) = n
-- A verification that a copy of a key exists in a repository.
data VerifiedCopy
- {- Use when a repository cannot be accessed, but it's
- - a trusted repository, which is on record as containing a key
- - and is presumably not going to lose its copy.
- - This is the weakest level of verification. -}
- = TrustedCopy V
{- Represents a recent verification that a copy of an
- object exists in a repository with the given UUID. -}
- | RecentlyVerifiedCopy V
+ = RecentlyVerifiedCopy V
+ {- Use when a repository cannot be accessed, but it's
+ - a trusted repository, which is on record as containing a key
+ - and is presumably not going to lose its copy. -}
+ | TrustedCopy V
{- The strongest proof of the existence of a copy.
- Until its associated action is called to unlock it,
- the copy is locked in the repository and is guaranteed
@@ -72,9 +71,9 @@ instance Show V where
strongestVerifiedCopy :: VerifiedCopy -> VerifiedCopy -> VerifiedCopy
strongestVerifiedCopy a@(VerifiedCopyLock _) _ = a
strongestVerifiedCopy _ b@(VerifiedCopyLock _) = b
+strongestVerifiedCopy a@(TrustedCopy _) _ = a
+strongestVerifiedCopy _ b@(TrustedCopy _) = b
strongestVerifiedCopy a@(RecentlyVerifiedCopy _) _ = a
-strongestVerifiedCopy _ b@(RecentlyVerifiedCopy _) = b
-strongestVerifiedCopy a@(TrustedCopy _) _ = a
-- Retains stronger verifications over weaker for the same uuid.
deDupVerifiedCopies :: [VerifiedCopy] -> [VerifiedCopy]