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.
This commit is contained in:
Joey Hess 2015-06-16 18:38:12 -04:00
parent a0a8127956
commit adba0595bd
4 changed files with 46 additions and 21 deletions

View file

@ -132,8 +132,8 @@ instance Arbitrary Key where
<*> ((succ . abs <$>) <$> arbitrary) -- chunknum cannot be 0 or negative
instance Hashable Key where
hashIO32 = hashIO32 . show
hashIO64 = hashIO64 . show
hashIO32 = hashIO32 . key2file
hashIO64 = hashIO64 . key2file
prop_idempotent_key_encode :: Key -> Bool
prop_idempotent_key_encode k = Just k == (file2key . key2file) k