Support building with bloomfilter 2.0.0.

This commit is contained in:
Joey Hess 2014-07-07 12:24:12 -04:00
parent 8037a3ad73
commit 33ad8beabb
3 changed files with 62 additions and 3 deletions

View file

@ -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

60
Utility/Bloom.hs Normal file
View file

@ -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

1
debian/changelog vendored
View file

@ -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