summaryrefslogtreecommitdiff
path: root/Annex/BloomFilter.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2015-06-16 18:38:12 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2015-06-16 18:50:13 -0400
commit2a4a641a3c940a652f62371f417433b47f7f3e79 (patch)
treee610e549f25dd4cd6719fcce9dcde14a69c46bd2 /Annex/BloomFilter.hs
parente3da28295e11972bcb14749ef294d1f39fb03efa (diff)
use bloom filter in second pass of sync --all --content
This is needed because when preferred content matches on files, the second pass would otherwise want to drop all keys. Using a bloom filter avoids this, and in the case of a false positive, a key will be left undropped that preferred content would allow dropping. Chances of that happening are a mere 1 in 1 million.
Diffstat (limited to 'Annex/BloomFilter.hs')
-rw-r--r--Annex/BloomFilter.hs4
1 files changed, 2 insertions, 2 deletions
diff --git a/Annex/BloomFilter.hs b/Annex/BloomFilter.hs
index 3ac81fa58..5773a88ee 100644
--- a/Annex/BloomFilter.hs
+++ b/Annex/BloomFilter.hs
@@ -40,11 +40,11 @@ bloomBitsHashes = do
- Once the action completes, the mutable filter is frozen
- for later use.
-}
-genBloomFilter :: Hashable v => ((v -> Annex ()) -> Annex b) -> Annex (Bloom v)
+genBloomFilter :: Hashable v => ((v -> Annex ()) -> Annex ()) -> Annex (Bloom v)
genBloomFilter populate = do
(numbits, numhashes) <- bloomBitsHashes
bloom <- lift $ newMB (cheapHashes numhashes) numbits
- _ <- populate $ \v -> lift $ insertMB bloom v
+ populate $ \v -> lift $ insertMB bloom v
lift $ unsafeFreezeMB bloom
where
lift = liftIO . stToIO