I have two different service, the first creates the bloom filter and the other one uses it.
For the first service which creates the bloom filter, I can build an off-heap bloom filter with memory mapped file as follows.
val bloomFilter = BloomFilter.builder()
.useOffHeapMemory(true)
.withExpectedNumberOfItems(numberOfElements)
.withFalsePositiveRate(expectedFPR)
.withFileMapped(file)
.build()
Since the bloom filter bit-vector gets written in file, this file can then be stored somewhere for later usage (effectively achieving serialization).
And while using the filter, I can open this bloom filter just the same way as above and query.
However, if I need to open this file as in-memory bloom filter, the api doesn't support it.
In case of in-memory bloom filter (i.e useOffHeapMemory(false)), there is a check that file parameter in withFileMapped(file) should be null. I understand that this is a valid check, since in-memory bloom filter has nothing to do with file.
But since the library doesn't have serialization/de-serialization, how do I open a bloom filter in-memory from a serialized file ?
I have two different service, the first creates the bloom filter and the other one uses it.
For the first service which creates the bloom filter, I can build an off-heap bloom filter with memory mapped file as follows.
Since the bloom filter bit-vector gets written in file, this file can then be stored somewhere for later usage (effectively achieving serialization).
And while using the filter, I can open this bloom filter just the same way as above and query.
However, if I need to open this file as in-memory bloom filter, the api doesn't support it.
In case of in-memory bloom filter (i.e
useOffHeapMemory(false)), there is a check thatfileparameter inwithFileMapped(file)should be null. I understand that this is a valid check, since in-memory bloom filter has nothing to do with file.But since the library doesn't have serialization/de-serialization, how do I open a bloom filter in-memory from a serialized file ?