Example #1
0
    def __init__(self, capacity, error_rate):
        '''
        :param capacity: How many items you want to store, eg. 10000
        :param error_rate: The acceptable false positive rate, eg. 0.001
        '''
        GenericBloomFilter.__init__(self, capacity, error_rate)

        temp_file = self.get_temp_file()
        self.bf = WrappedBloomFilter(capacity, error_rate, temp_file)
Example #2
0
    def __init__(self, capacity, error_rate):
        """
        :param capacity: How many items you want to store, eg. 10000
        :param error_rate: The acceptable false positive rate, eg. 0.001
        """
        GenericBloomFilter.__init__(self, capacity, error_rate)

        temp_file = self.get_temp_file()
        self.bf = FileSeekBloomFilter(capacity, error_rate, temp_file)
Example #3
0
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

'''
from core.data.bloomfilter.wrappers import GenericBloomFilter

# This import can't fail, it is pure-python love ;)
from core.data.bloomfilter.seekfile_bloom import FileSeekBloomFilter\
    as FileSeekFilter

try:
    # This might fail since it is a C library that only works in Linux
    from pybloomfilter import BloomFilter as CMmapFilter

    # There were reports of the C mmap filter not working properly in OSX,
    # just in case, I'm testing here...
    temp_file = GenericBloomFilter.get_temp_file()
    try:
        bf = CMmapFilter(1000, 0.01, temp_file)
        bf.add(1)
        assert 1 in bf
        assert 2 not in bf
    except:
        WrappedBloomFilter = FileSeekFilter
    else:
        WrappedBloomFilter = CMmapFilter

except:
    WrappedBloomFilter = FileSeekFilter


class BloomFilter(GenericBloomFilter):
Example #4
0
 def setUp(self):
     super(TestFileSeekBloomFilterSmall, self).setUp()
     temp_file = GenericBloomFilter.get_temp_file()
     self.filter = FileSeekBloomFilter(self.CAPACITY, self.ERROR_RATE,
                                       temp_file)
Example #5
0
 def setUp(self):
     super(TestCMmapBloomfilterSmall, self).setUp()
     temp_file = GenericBloomFilter.get_temp_file()
     self.filter = CMmapFilter(self.CAPACITY, self.ERROR_RATE, temp_file)
Example #6
0
 def setUp(self):
     super(TestCMmapBloomfilterLarge, self).setUp()
     temp_file = GenericBloomFilter.get_temp_file()
     self.filter = CMmapFilter(self.CAPACITY, self.ERROR_RATE, temp_file)
Example #7
0
 def setUp(self):
     super(TestFileSeekBloomFilterLarge, self).setUp()
     temp_file = GenericBloomFilter.get_temp_file()
     self.filter = FileSeekBloomFilter(self.CAPACITY, self.ERROR_RATE, temp_file)
Example #8
0
'''
from core.data.bloomfilter.wrappers import GenericBloomFilter

# This import can't fail, it is pure-python love ;)
from core.data.bloomfilter.seekfile_bloom import FileSeekBloomFilter\
    as FileSeekFilter


try:
    # This might fail since it is a C library that only works in Linux
    from pybloomfilter import BloomFilter as CMmapFilter

    # There were reports of the C mmap filter not working properly in OSX,
    # just in case, I'm testing here...
    temp_file = GenericBloomFilter.get_temp_file()
    try:
        bf = CMmapFilter(1000, 0.01, temp_file)
        bf.add(1)
        assert 1 in bf
        assert 2 not in bf
    except:
        WrappedBloomFilter = FileSeekFilter
    else:
        WrappedBloomFilter = CMmapFilter

except:
    WrappedBloomFilter = FileSeekFilter


class BloomFilter(GenericBloomFilter):