Package jadex.requiredservice.impl
Class SlidingCuckooFilter
java.lang.Object
jadex.requiredservice.impl.SlidingCuckooFilter
Filter class based on two cuckoo filter.
Splits the capacity into two filters, if the capacity is
exceeded, the older filter is dropped and a new filter is created.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected int
The bucket size / entries per bucker.protected net.cinnom.nanocuckoo.NanoCuckooFilter
The current filter.protected net.cinnom.nanocuckoo.NanoCuckooFilter
The currently expiring filter.protected byte
Size of fingerprints in bits. -
Constructor Summary
ConstructorsConstructorDescriptionCreates the cuckoo filter with the given capacity and a false positive probability of ~1:500000.SlidingCuckooFilter
(long capacity, int bucketsize, byte fingerprintsize) Creates the cuckoo filter with the given capacity and false positive probability. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Check if a given byte array is contained in the filter.protected net.cinnom.nanocuckoo.NanoCuckooFilter
createFilter
(long capacity) Creates a new filter.void
Delete a value from the filter.void
Insert a byte array into the filter.
-
Field Details
-
expiringfilter
protected net.cinnom.nanocuckoo.NanoCuckooFilter expiringfilterThe currently expiring filter. -
currentfilter
protected net.cinnom.nanocuckoo.NanoCuckooFilter currentfilterThe current filter. -
bucketsize
protected int bucketsizeThe bucket size / entries per bucker. -
fingerprintsize
protected byte fingerprintsizeSize of fingerprints in bits.
-
-
Constructor Details
-
SlidingCuckooFilter
public SlidingCuckooFilter()Creates the cuckoo filter with the given capacity and a false positive probability of ~1:500000.- Parameters:
capacity
- Capacity.
-
SlidingCuckooFilter
public SlidingCuckooFilter(long capacity, int bucketsize, byte fingerprintsize) Creates the cuckoo filter with the given capacity and false positive probability.- Parameters:
capacity
- Filter capacity of a single filter.bucketsize
- Size of buckets.fingerprintsize
- Size of fingerprints.
-
-
Method Details
-
insert
Insert a byte array into the filter.- Parameters:
string
- The data being inserted.
-
delete
Delete a value from the filter.- Parameters:
val
- The value to delete.
-
contains
Check if a given byte array is contained in the filter.- Parameters:
data
- The data being checked.- Returns:
- True if value is probably contained.
-
createFilter
protected net.cinnom.nanocuckoo.NanoCuckooFilter createFilter(long capacity) Creates a new filter.- Parameters:
capacity
- Filter capacity.bucketsize
- Size of bucketsfingerprintsize
- Size of fingerprints.- Returns:
- The filter.
-