Skip to content

Loading from disk fails #5

@dare05

Description

@dare05

Here's the code:

filter = BloomFilter.new size: 100_000, error_rate: 0.00001
100_000.times do
  filter.insert "#{rand(1..1_000_000)}"
end
filter.dump "hii"

Now when I do:

filter = BloomFilter.load "hii"

I get:

in `load': unable to load BloomFilter, expected 299534 but got 420 bytes (StandardError)

I'm supposing this has to do with the operating system, I'm using Windows 7, and it prob has to do with it having 2 ways to load/save files to disk (text/binary mode).

I actually had the same problem with bloomfilter-rb and I fixed it by forcing File.open to write and read in binary mode (it was as easy as appending "b" to the "r" and "w" modes). But here I see the code for serialization is written in C, so that wouldn't be possible.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions