| Title: | Bloom Filters |
|---|---|
| Description: | Scaling, counting Bloom filter for R using Rcpp bindings for dablooms. |
| Authors: | Jim Hester |
| Maintainer: | Jim Hester <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.1.0 |
| Built: | 2026-05-17 09:32:52 UTC |
| Source: | https://github.com/jimhester/bloom |
Create a new scaling, counting bloom filter, or load a bloom filter from a pre-existing file.
bloom(capacity = 1000, error_rate = 0.05, filename = tempfile(fileext = ".bin"), exists = file.exists(filename))bloom(capacity = 1000, error_rate = 0.05, filename = tempfile(fileext = ".bin"), exists = file.exists(filename))
capacity |
the approximate expected capacity |
error_rate |
the desired error rate |
filename |
the location to store the filter |
exists |
if the filter exists, load the new filter from a pre-existing file, otherwise create a new filer. |
The filter has the following methods available
addAdd a new item to the bloom filter, each item should be assigned a monotonically increasing integer id as the second argument.
containsCheck if a given item is contained within the bloom filter.
removeRemove a given item from the filter, the id should match the id given when the item was added.
library(bloom) bloom <- bloom(capacity = 1000, error_rate = .05, filename = "/tmp/bloom.bin") bloom$add("foo", 2) bloom$contains("bar") bloom$contains("foo") bloom$remove("foo", 2) bloom$contains("foo") bloom$add("foo", 2) rm(bloom) bloom <- bloom(capacity = 1000, error_rate = .05, filename = "/tmp/bloom.bin", exists = TRUE) bloom$contains("foo")library(bloom) bloom <- bloom(capacity = 1000, error_rate = .05, filename = "/tmp/bloom.bin") bloom$add("foo", 2) bloom$contains("bar") bloom$contains("foo") bloom$remove("foo", 2) bloom$contains("foo") bloom$add("foo", 2) rm(bloom) bloom <- bloom(capacity = 1000, error_rate = .05, filename = "/tmp/bloom.bin", exists = TRUE) bloom$contains("foo")