Package org.forgerock.bloomfilter
Class BloomFilters.ScalableBloomFilterBuilder<T>
- java.lang.Object
-
- org.forgerock.bloomfilter.BloomFilters.BloomFilterBuilder<T>
-
- org.forgerock.bloomfilter.BloomFilters.ScalableBloomFilterBuilder<T>
-
- Type Parameters:
T
- the type of elements contained in this bloom filter.
- Direct Known Subclasses:
BloomFilters.RollingBloomFilterBuilder
- Enclosing class:
- BloomFilters
public static class BloomFilters.ScalableBloomFilterBuilder<T> extends BloomFilters.BloomFilterBuilder<T>
Builder pattern for Scalable Bloom Filters.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BloomFilters.ScalableBloomFilterBuilder<T>
withCapacityGrowthFactor(double growthFactor)
The factor by which to increase the capacity of the bloom filter when it exceeds the initial capacity.BloomFilters.ScalableBloomFilterBuilder<T>
withFalsePositiveProbabilityScaleFactor(double scaleFactor)
The factor by which to reduce the probability of false positives when expanding a scalable/rolling bloom filter.BloomFilters.ScalableBloomFilterBuilder<T>
withMaximumNumberOfBuckets(int maximumNumberOfBuckets)
Sets the maximum number of buckets to create before throwing an exception indicating the maximum capacity has been reached.-
Methods inherited from class org.forgerock.bloomfilter.BloomFilters.BloomFilterBuilder
build, rolling, scalable, withConcurrencyStrategy, withExpiryStrategy, withFalsePositiveProbability, withInitialCapacity, withWriteBatchSize
-
-
-
-
Method Detail
-
withCapacityGrowthFactor
public BloomFilters.ScalableBloomFilterBuilder<T> withCapacityGrowthFactor(double growthFactor)
Description copied from class:BloomFilters.BloomFilterBuilder
The factor by which to increase the capacity of the bloom filter when it exceeds the initial capacity. A factor of 1 will increase the capacity linearly, which may result in an explosion in the number of buckets if the expected capacity of the filter has been underestimated. The default factor is 2, which ensures that the bloom filter quickly grows to be "large enough" without creating a large number of buckets (i.e., the number of buckets created will be logarithmic in the total number of insertions).- Overrides:
withCapacityGrowthFactor
in classBloomFilters.BloomFilterBuilder<T>
- Parameters:
growthFactor
- the factor by which to increase bloom filter capacity when expanding.
-
withFalsePositiveProbabilityScaleFactor
public BloomFilters.ScalableBloomFilterBuilder<T> withFalsePositiveProbabilityScaleFactor(double scaleFactor)
Description copied from class:BloomFilters.BloomFilterBuilder
The factor by which to reduce the probability of false positives when expanding a scalable/rolling bloom filter. As the overall false positive probability (FPP) is the sum of the probabilities of each component bloom filter in the chain, the FPP of each subsequent bucket is reduced by this factor so that the sum never exceeds the overall FPP. A factor close to 1 will reduce the FPP slowly, limiting the additional memory used on each expansion, but with the trade-off of using more memory initially. A lower number will use less memory initially but then decrease the FPP more rapidly, resulting in increased memory usage. The default setting (0.8) is tuned for scalable bloom filters that grow unbounded over time. It is recommended to reduce the factor in rolling bloom filters where the chain is expected not to grow beyond a few buckets in size.- Overrides:
withFalsePositiveProbabilityScaleFactor
in classBloomFilters.BloomFilterBuilder<T>
- Parameters:
scaleFactor
- the factor by which to decrease the false positive probability when expanding.
-
withMaximumNumberOfBuckets
public BloomFilters.ScalableBloomFilterBuilder<T> withMaximumNumberOfBuckets(int maximumNumberOfBuckets)
Description copied from class:BloomFilters.BloomFilterBuilder
Sets the maximum number of buckets to create before throwing an exception indicating the maximum capacity has been reached. Defaults to unlimited.- Overrides:
withMaximumNumberOfBuckets
in classBloomFilters.BloomFilterBuilder<T>
- Parameters:
maximumNumberOfBuckets
- the maximum number of buckets to create.
-
-