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
|
getcopies fs = do
|
||||||
(untrusted, have) <- trustPartition UnTrusted locs
|
(untrusted, have) <- trustPartition UnTrusted locs
|
||||||
(numcopies, mincopies) <- getSafestNumMinCopies' afile key fs
|
(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.
|
{- Check that we have enough copies still to drop the content.
|
||||||
- When the remote being dropped from is untrusted, it was not
|
- When the remote being dropped from is untrusted, it was not
|
||||||
|
|
|
@ -20,6 +20,7 @@ module Annex.NumCopies (
|
||||||
defaultNumCopies,
|
defaultNumCopies,
|
||||||
numCopiesCheck,
|
numCopiesCheck,
|
||||||
numCopiesCheck',
|
numCopiesCheck',
|
||||||
|
numCopiesCheck'',
|
||||||
numCopiesCount,
|
numCopiesCount,
|
||||||
verifyEnoughCopiesToDrop,
|
verifyEnoughCopiesToDrop,
|
||||||
verifiableCopies,
|
verifiableCopies,
|
||||||
|
@ -199,12 +200,17 @@ numCopiesCheck file key vs = do
|
||||||
|
|
||||||
numCopiesCheck' :: RawFilePath -> (Int -> Int -> v) -> [UUID] -> Annex v
|
numCopiesCheck' :: RawFilePath -> (Int -> Int -> v) -> [UUID] -> Annex v
|
||||||
numCopiesCheck' file vs have = do
|
numCopiesCheck' file vs have = do
|
||||||
needed <- fromNumCopies . fst <$> getFileNumMinCopies file
|
needed <- fst <$> getFileNumMinCopies file
|
||||||
let nhave = numCopiesCount have
|
let nhave = numCopiesCount have
|
||||||
explain (ActionItemTreeFile file) $ Just $ UnquotedString $
|
explain (ActionItemTreeFile file) $ Just $ UnquotedString $
|
||||||
"has " ++ show nhave ++ " " ++ pluralCopies nhave ++
|
"has " ++ show nhave ++ " " ++ pluralCopies nhave ++
|
||||||
", and the configured annex.numcopies is " ++ show needed
|
", 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,
|
{- 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
|
- 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
|
uuid <- getUUID
|
||||||
let remoteuuid = fromMaybe uuid $ Remote.uuid <$> mremote
|
let remoteuuid = fromMaybe uuid $ Remote.uuid <$> mremote
|
||||||
locs' <- trustExclude UnTrusted $ filter (/= remoteuuid) locs
|
locs' <- trustExclude UnTrusted $ filter (/= remoteuuid) locs
|
||||||
if length locs' >= fromNumCopies numcopies
|
if numCopiesCheck'' locs' (>=) numcopies
|
||||||
then a numcopies mincopies
|
then a numcopies mincopies
|
||||||
else stop
|
else stop
|
||||||
| otherwise = a numcopies mincopies
|
| otherwise = a numcopies mincopies
|
||||||
|
|
|
@ -573,7 +573,7 @@ checkKeyNumCopies key afile numcopies = do
|
||||||
locs <- loggedLocations key
|
locs <- loggedLocations key
|
||||||
(untrustedlocations, otherlocations) <- trustPartition UnTrusted locs
|
(untrustedlocations, otherlocations) <- trustPartition UnTrusted locs
|
||||||
(deadlocations, safelocations) <- trustPartition DeadTrusted otherlocations
|
(deadlocations, safelocations) <- trustPartition DeadTrusted otherlocations
|
||||||
let present = length safelocations
|
let present = numCopiesCount safelocations
|
||||||
if present < fromNumCopies numcopies
|
if present < fromNumCopies numcopies
|
||||||
then ifM (checkDead key)
|
then ifM (checkDead key)
|
||||||
( do
|
( do
|
||||||
|
|
5
Limit.hs
5
Limit.hs
|
@ -408,7 +408,7 @@ limitCopies want = case splitc ':' want of
|
||||||
go' n good notpresent key = do
|
go' n good notpresent key = do
|
||||||
us <- filter (`S.notMember` notpresent)
|
us <- filter (`S.notMember` notpresent)
|
||||||
<$> (filterM good =<< Remote.keyLocations key)
|
<$> (filterM good =<< Remote.keyLocations key)
|
||||||
return $ length us >= n
|
return $ numCopiesCount us >= n
|
||||||
checktrust checker u = checker <$> lookupTrust u
|
checktrust checker u = checker <$> lookupTrust u
|
||||||
checkgroup g u = S.member g <$> lookupGroups u
|
checkgroup g u = S.member g <$> lookupGroups u
|
||||||
parsetrustspec s
|
parsetrustspec s
|
||||||
|
@ -442,7 +442,8 @@ limitLackingCopies desc approx want = case readish want of
|
||||||
MatchingUserInfo {} -> approxNumCopies
|
MatchingUserInfo {} -> approxNumCopies
|
||||||
us <- filter (`S.notMember` notpresent)
|
us <- filter (`S.notMember` notpresent)
|
||||||
<$> (trustExclude UnTrusted =<< Remote.keyLocations key)
|
<$> (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
|
approxNumCopies = fromMaybe defaultNumCopies <$> getGlobalNumCopies
|
||||||
|
|
||||||
{- Match keys that are unused.
|
{- 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
|
* Omit cluster UUIDs when constructing drop proofs, since lockcontent will
|
||||||
always fail on a cluster. (done)
|
always fail on a cluster. (done)
|
||||||
|
|
||||||
* Don't count cluster UUID as a copy. (Including in `whereis` display.)
|
* Don't count cluster UUID as a copy. (done)
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
* Basic proxying to special remote support (non-streaming).
|
* Basic proxying to special remote support (non-streaming).
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue