Add byte-budget construction for Bloom filters - #841
Conversation
|
Hi @yuweih205, Thanks for contributing to cuco! In short, 'bloom_filter(bloom_filter_bytes size)' allocates a filter that is always smaller or equal to 'size'; never exceeding it. One small nit: I would suggest to rename the strong type for the filter size to `bloom_filter_bytes' as it is a bit shorter. Do you agree with these changes? Happy to discuss and thanks again for your work on this! |
Treat bloom_filter_bytes as a storage budget, round down to whole blocks, and cap at max_size(). Restrict the overload to dynamic extents and fold coverage into the existing policy test. Signed-off-by: HuangYuwei <yuweih205@gmail.com>
|
Agreed—updated. |
|
/ok to test c80884c |
Fixes #829.
Adds
cuco::bloom_filter_bytesconstruction for dynamic-extent Bloom filters. The value is an upper-bound storage budget: allocation is rounded down to whole filter blocks and capped atmax_size(), so it never exceeds the requested bytes. Budgets smaller than one block fail before allocation.The existing block-count constructor remains unchanged. Coverage is folded into the existing Bloom filter policy test rather than a separate test target.
Local validation: repository formatting and copyright hooks, plus
git diff --check.