aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-07-07 12:24:12 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-07-07 12:24:12 -0400
commitb0aa47f30d2224284d65ea3c60de2ba84ded72e4 (patch)
treeb64dbd2a5376cd1dbcae12f0dc7b4488ad7787d1
parent8921122d148983af43b0185cec3461f213c6507d (diff)
Support building with bloomfilter 2.0.0.
-rw-r--r--Command/Unused.hs4
-rw-r--r--Utility/Bloom.hs60
-rw-r--r--debian/changelog1
3 files changed, 62 insertions, 3 deletions
diff --git a/Command/Unused.hs b/Command/Unused.hs
index 6737109f6..bf98e53bc 100644
--- a/Command/Unused.hs
+++ b/Command/Unused.hs
@@ -10,9 +10,6 @@
module Command.Unused where
import qualified Data.Set as S
-import Data.BloomFilter
-import Data.BloomFilter.Easy
-import Data.BloomFilter.Hash
import Control.Monad.ST
import qualified Data.Map as M
@@ -36,6 +33,7 @@ import Annex.CatFile
import Types.Key
import Git.FilePath
import Logs.View (is_branchView)
+import Utility.Bloom
def :: [Command]
def = [withOptions [unusedFromOption] $ command "unused" paramNothing seek
diff --git a/Utility/Bloom.hs b/Utility/Bloom.hs
new file mode 100644
index 000000000..e3000de3d
--- /dev/null
+++ b/Utility/Bloom.hs
@@ -0,0 +1,60 @@
+{- bloomfilter compatability wrapper
+ -
+ - Copyright 2014 Joey Hess <joey@kitenet.net>
+ -
+ - License: BSD-2-clause
+ -}
+
+{-# LANGUAGE CPP #-}
+
+module Utility.Bloom (
+ Bloom,
+ suggestSizing,
+ Hashable,
+ cheapHashes,
+ notElemB,
+
+ newMB,
+ insertMB,
+ unsafeFreezeMB,
+) where
+
+#if MIN_VERSION_bloomfilter(2,0,0)
+import qualified Data.BloomFilter.Mutable as MBloom
+import qualified Data.BloomFilter as Bloom
+#else
+import qualified Data.BloomFilter as Bloom
+#endif
+import Data.BloomFilter.Easy (suggestSizing, Bloom)
+import Data.BloomFilter.Hash (Hashable, cheapHashes)
+import Control.Monad.ST.Safe (ST)
+
+#if MIN_VERSION_bloomfilter(2,0,0)
+
+notElemB :: a -> Bloom a -> Bool
+notElemB = Bloom.notElem
+
+newMB :: (a -> [Bloom.Hash]) -> Int -> ST s (MBloom.MBloom s a)
+newMB = MBloom.new
+
+insertMB :: MBloom.MBloom s a -> a -> ST s ()
+insertMB = MBloom.insert
+
+unsafeFreezeMB :: MBloom.MBloom s a -> ST s (Bloom a)
+unsafeFreezeMB = Bloom.unsafeFreeze
+
+#else
+
+notElemB :: a -> Bloom a -> Bool
+notElemB = Bloom.notElemB
+
+newMB :: (a -> [Bloom.Hash]) -> Int -> ST s (Bloom.MBloom s a)
+newMB = Bloom.newMB
+
+insertMB :: Bloom.MBloom s a -> a -> ST s ()
+insertMB = Bloom.insertMB
+
+unsafeFreezeMB :: Bloom.MBloom s a -> ST s (Bloom a)
+unsafeFreezeMB = Bloom.unsafeFreezeMB
+
+#endif
diff --git a/debian/changelog b/debian/changelog
index 701f07e53..043138642 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -20,6 +20,7 @@ git-annex (5.20140614) UNRELEASED; urgency=medium
branch, eg after git-annex add has run on 2 million files in one go.
* assistant: Fix bug, introduced in last release, that caused the assistant
to make many unncessary empty merge commits.
+ * Support building with bloomfilter 2.0.0.
-- Joey Hess <joeyh@debian.org> Mon, 16 Jun 2014 11:28:42 -0400