Pacote
    Preparing search index...

    Class CountingBloomFilter<T>

    A counting Bloom filter that tracks approximate membership counts and supports removal.

    Like a standard Bloom filter, it can report false positives. The returned count is therefore a possible count, not proof of exact membership.

    Type Parameters

    • T extends { toString(): string }

      Values represented by the filter.

    Index
    • Creates a counting filter from its size, hash count, and optional seed or counters.

      Type Parameters

      • T extends { toString(): string }

        Values represented by the filter.

      Parameters

      • options: Options

        Filter size, hash count, and optional initial state.

      Returns CountingBloomFilter<T>

      A new counting Bloom filter.

      Error if size or hashes is not a positive integer, or if filter does not hold size counters.

    filter: Uint32Array
    hashes: number
    seed: number
    size: number
    • Adds an instance of an element and increments its counters.

      Parameters

      • element: T

        Value to add.

      Returns void

    • Returns the possible number of times an element was added.

      Parameters

      • element: T

        Value to look up.

      Returns number

      The minimum counter value for this element's hash positions.

    • Removes an instance of an element without allowing counters below zero.

      Parameters

      • element: T

        Value to remove.

      Returns void