class BloomFilter::Filter

Defined in:

bloom_filter/filter.cr

Constant Summary

MULT_A = 3098757933_u32
MULT_B = 1388749529_u32
SEED_A = 3735928559_u32
SEED_B = 1912536813_u32

Constructors

Instance Method Summary

Constructor Detail

def self.new(bytesize : UInt32, hash_num, bitmap : Array(UInt8) = Array(UInt8).new(bytesize.to_i32, 0_u8)) #

[View source]
def self.new(io : IO) #

I used to load filter from file (see BloomFilter.load).


[View source]

Instance Method Detail

def &(another : Filter) : Filter #

Get intersection of two filters.


[View source]
def ==(another : Filter) #

[View source]
def |(another : Filter) : Filter #

Get a union of two filters.


[View source]
def bitmap : Array(UInt8) #

[View source]
def bitsize : UInt32 #

[View source]
def bytesize : UInt32 #

[View source]
def dump(io : IO) #

[View source]
def dump_file(file_path) #

Saves bloom filter into binary file.


[View source]
def has?(str : String) : Bool #

Verifies, whether the filter contains given item.


[View source]
def hash_num : UInt8 #

[View source]
def insert(str : String) #

[View source]
def visualize #

Convert bitmap into string representation of bitmap with highlighted bits. Should be used only for debugging and fun:)


[View source]