don't count clusters as copies, continued
Handled limitCopies, as well as everything using fromNumCopies and fromMinCopies. This should be everything, probably. Note that, git-annex info displays a count of repositories, which still includes cluster. I think that's ok. It would be possible to filter out clusters there, but to the user they're pretty much just another repository. The numcopies displayed by eg `git-annex info .` does not include clusters.
This commit is contained in:
parent
780367200b
commit
64afbb0b93
6 changed files with 15 additions and 12 deletions
|
@ -58,7 +58,7 @@ handleDropsFrom locs rs reason fromhere key afile si preverified runner = do
|
|||
getcopies fs = do
|
||||
(untrusted, have) <- trustPartition UnTrusted locs
|
||||
(numcopies, mincopies) <- getSafestNumMinCopies' afile key fs
|
||||
return (length have, numcopies, mincopies, S.fromList untrusted)
|
||||
return (numCopiesCount have, numcopies, mincopies, S.fromList untrusted)
|
||||
|
||||
{- Check that we have enough copies still to drop the content.
|
||||
- When the remote being dropped from is untrusted, it was not
|
||||
|
|
|
@ -20,6 +20,7 @@ module Annex.NumCopies (
|
|||
defaultNumCopies,
|
||||
numCopiesCheck,
|
||||
numCopiesCheck',
|
||||
numCopiesCheck'',
|
||||
numCopiesCount,
|
||||
verifyEnoughCopiesToDrop,
|
||||
verifiableCopies,
|
||||
|
@ -199,12 +200,17 @@ numCopiesCheck file key vs = do
|
|||
|
||||
numCopiesCheck' :: RawFilePath -> (Int -> Int -> v) -> [UUID] -> Annex v
|
||||
numCopiesCheck' file vs have = do
|
||||
needed <- fromNumCopies . fst <$> getFileNumMinCopies file
|
||||
needed <- fst <$> getFileNumMinCopies file
|
||||
let nhave = numCopiesCount have
|
||||
explain (ActionItemTreeFile file) $ Just $ UnquotedString $
|
||||
"has " ++ show nhave ++ " " ++ pluralCopies nhave ++
|
||||
", and the configured annex.numcopies is " ++ show needed
|
||||
return $ nhave `vs` needed
|
||||
return $ numCopiesCheck'' have vs needed
|
||||
|
||||
numCopiesCheck'' :: [UUID] -> (Int -> Int -> v) -> NumCopies -> v
|
||||
numCopiesCheck'' have vs needed =
|
||||
let nhave = numCopiesCount have
|
||||
in nhave `vs` fromNumCopies needed
|
||||
|
||||
{- When a key is logged as present in a node of the cluster,
|
||||
- the cluster's UUID will also be in the list, but is not a
|
||||
|
|
|
@ -253,7 +253,7 @@ checkDropAuto automode mremote afile key a =
|
|||
uuid <- getUUID
|
||||
let remoteuuid = fromMaybe uuid $ Remote.uuid <$> mremote
|
||||
locs' <- trustExclude UnTrusted $ filter (/= remoteuuid) locs
|
||||
if length locs' >= fromNumCopies numcopies
|
||||
if numCopiesCheck'' locs' (>=) numcopies
|
||||
then a numcopies mincopies
|
||||
else stop
|
||||
| otherwise = a numcopies mincopies
|
||||
|
|
|
@ -573,7 +573,7 @@ checkKeyNumCopies key afile numcopies = do
|
|||
locs <- loggedLocations key
|
||||
(untrustedlocations, otherlocations) <- trustPartition UnTrusted locs
|
||||
(deadlocations, safelocations) <- trustPartition DeadTrusted otherlocations
|
||||
let present = length safelocations
|
||||
let present = numCopiesCount safelocations
|
||||
if present < fromNumCopies numcopies
|
||||
then ifM (checkDead key)
|
||||
( do
|
||||
|
|
5
Limit.hs
5
Limit.hs
|
@ -408,7 +408,7 @@ limitCopies want = case splitc ':' want of
|
|||
go' n good notpresent key = do
|
||||
us <- filter (`S.notMember` notpresent)
|
||||
<$> (filterM good =<< Remote.keyLocations key)
|
||||
return $ length us >= n
|
||||
return $ numCopiesCount us >= n
|
||||
checktrust checker u = checker <$> lookupTrust u
|
||||
checkgroup g u = S.member g <$> lookupGroups u
|
||||
parsetrustspec s
|
||||
|
@ -442,7 +442,8 @@ limitLackingCopies desc approx want = case readish want of
|
|||
MatchingUserInfo {} -> approxNumCopies
|
||||
us <- filter (`S.notMember` notpresent)
|
||||
<$> (trustExclude UnTrusted =<< Remote.keyLocations key)
|
||||
return $ fromNumCopies numcopies - length us >= needed
|
||||
let vs nhave numcopies' = numcopies' - nhave >= needed
|
||||
return $ numCopiesCheck'' us vs numcopies
|
||||
approxNumCopies = fromMaybe defaultNumCopies <$> getGlobalNumCopies
|
||||
|
||||
{- Match keys that are unused.
|
||||
|
|
|
@ -48,11 +48,7 @@ For June's work on [[design/passthrough_proxy]], implementation plan:
|
|||
* Omit cluster UUIDs when constructing drop proofs, since lockcontent will
|
||||
always fail on a cluster. (done)
|
||||
|
||||
* Don't count cluster UUID as a copy. (Including in `whereis` display.)
|
||||
|
||||
Work in progress. fromNumCopies is sometimes used to get a
|
||||
number that is compared with a list of UUIDs. And limitCopies doesn't
|
||||
use numcopies machinery
|
||||
* Don't count cluster UUID as a copy. (done)
|
||||
|
||||
* Basic proxying to special remote support (non-streaming).
|
||||
|
||||
|
|
Loading…
Reference in a new issue