summaryrefslogtreecommitdiff
path: root/Config
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2015-04-12 12:49:11 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2015-04-12 12:54:41 -0400
commitc6ba6fb9bda03fa1ec43aae54197777a04a54a62 (patch)
tree4dbdab956fb87041e9b13fea7981e01a91602811 /Config
parent5b3e97f72cf4fdaac4642b6e9fd48ff6419bda1d (diff)
info dir: Added information about repositories that contain files in the specified directory.
This is a nearly free feature; it piggybacks on the location log lookups done for the numcopies stats. So, the only extra overhead is updating the map of repository sizes. However, I had to switch to Data.Map.Strict, which needs containers 0.5. If backporting to wheezy, will probably need to revert this commit.
Diffstat (limited to 'Config')
-rw-r--r--Config/NumCopies.hs11
1 files changed, 8 insertions, 3 deletions
diff --git a/Config/NumCopies.hs b/Config/NumCopies.hs
index b25e0818d..50dcdf684 100644
--- a/Config/NumCopies.hs
+++ b/Config/NumCopies.hs
@@ -11,9 +11,10 @@ module Config.NumCopies (
getFileNumCopies,
getGlobalFileNumCopies,
getNumCopies,
- numCopiesCheck,
deprecatedNumCopies,
- defaultNumCopies
+ defaultNumCopies,
+ numCopiesCheck,
+ numCopiesCheck',
) where
import Common.Annex
@@ -75,6 +76,10 @@ getFileNumCopies' file = maybe getGlobalNumCopies (return . Just) =<< getattr
- belived to exist, and the configured value. -}
numCopiesCheck :: FilePath -> Key -> (Int -> Int -> v) -> Annex v
numCopiesCheck file key vs = do
- NumCopies needed <- getFileNumCopies file
have <- trustExclude UnTrusted =<< Remote.keyLocations key
+ numCopiesCheck' file vs have
+
+numCopiesCheck' :: FilePath -> (Int -> Int -> v) -> [UUID] -> Annex v
+numCopiesCheck' file vs have = do
+ NumCopies needed <- getFileNumCopies file
return $ length have `vs` needed