summaryrefslogtreecommitdiffstats
path: root/toolkit/components/cascade_bloom_filter/nsICascadeFilter.idl
blob: 2f6dc37f9066afcdcf2baf3cae7f2851e5062d2f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#include "nsISupports.idl"

/**
 * A consumer of a filter cascade, i.e. a cascaded bloom filter as generated by
 * https://github.com/mozilla/filter-cascade
 */
[scriptable, uuid(c8d0b0b3-17f8-458b-9264-7b67b288fe79)]
interface nsICascadeFilter : nsISupports {
  /**
   * Initialize with the data that represents the filter cascade.
   * This method can be called repeatedly.
   *
   * @throws NS_ERROR_INVALID_ARG if the input is malformed.
   */
  void setFilterData(in Array<octet> data);

  /**
   * Check whether a given key is a member of the filter cascade.
   * The result can only be relied upon if the key was known at the time of the
   * filter generation. If the key is unknown, the method may incorrectly
   * return true (due to the probabilistic nature of bloom filters).
   */
  boolean has(in ACString key);
};