Class SlidingCuckooFilter


  • public class SlidingCuckooFilter
    extends java.lang.Object
    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

      Fields 
      Modifier and Type Field Description
      protected int bucketsize
      The bucket size / entries per bucker.
      protected net.cinnom.nanocuckoo.NanoCuckooFilter currentfilter
      The current filter.
      protected net.cinnom.nanocuckoo.NanoCuckooFilter expiringfilter
      The currently expiring filter.
      protected byte fingerprintsize
      Size of fingerprints in bits.
    • Constructor Summary

      Constructors 
      Constructor Description
      SlidingCuckooFilter()
      Creates 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

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean contains​(java.lang.String string)
      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​(java.lang.String val)
      Delete a value from the filter.
      void insert​(java.lang.String string)
      Insert a byte array into the filter.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • expiringfilter

        protected net.cinnom.nanocuckoo.NanoCuckooFilter expiringfilter
        The currently expiring filter.
      • currentfilter

        protected net.cinnom.nanocuckoo.NanoCuckooFilter currentfilter
        The current filter.
      • bucketsize

        protected int bucketsize
        The bucket size / entries per bucker.
      • fingerprintsize

        protected byte fingerprintsize
        Size of fingerprints in bits.
    • Constructor Detail

      • 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 Detail

      • insert

        public void insert​(java.lang.String string)
        Insert a byte array into the filter.
        Parameters:
        string - The data being inserted.
      • delete

        public void delete​(java.lang.String val)
        Delete a value from the filter.
        Parameters:
        val - The value to delete.
      • contains

        public boolean contains​(java.lang.String string)
        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 buckets
        fingerprintsize - Size of fingerprints.
        Returns:
        The filter.