2011-09-16 14:34:05 -07:00
|
|
|
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 04:12:37 -07:00
|
|
|
/* 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/. */
|
2011-09-16 14:34:05 -07:00
|
|
|
|
2011-09-08 13:15:08 -07:00
|
|
|
#include "nsISupports.idl"
|
2011-09-08 13:16:59 -07:00
|
|
|
#include "nsIFile.idl"
|
2011-09-08 13:15:08 -07:00
|
|
|
|
2012-04-19 22:46:47 -07:00
|
|
|
interface nsIArray;
|
|
|
|
|
2012-01-10 08:09:32 -08:00
|
|
|
// Note that the PrefixSet name is historical and we do properly support
|
|
|
|
// duplicated values, so it's really a Prefix Trie.
|
|
|
|
// All methods are thread-safe.
|
2012-04-19 22:46:47 -07:00
|
|
|
|
|
|
|
[scriptable, uuid(519c8519-0f30-426b-bb7b-c400ba0318e2)]
|
2011-09-08 13:15:08 -07:00
|
|
|
interface nsIUrlClassifierPrefixSet : nsISupports
|
|
|
|
{
|
2012-01-10 08:09:32 -08:00
|
|
|
// Fills the PrefixSet with the given array of prefixes.
|
|
|
|
// Can send an empty Array to clear the tree. A truly "empty tree"
|
|
|
|
// cannot be represented, so put a sentinel value if that is required
|
|
|
|
// Requires array to be sorted.
|
2011-09-08 13:15:08 -07:00
|
|
|
void setPrefixes([const, array, size_is(aLength)] in unsigned long aPrefixes,
|
|
|
|
in unsigned long aLength);
|
2012-01-10 08:09:32 -08:00
|
|
|
// Do a lookup in the PrefixSet, return whether the value is present.
|
|
|
|
// If aReady is set, we will block until there are any entries.
|
|
|
|
// If not set, we will return in aReady whether we were ready or not.
|
2012-04-19 22:46:47 -07:00
|
|
|
boolean probe(in unsigned long aPrefix, in unsigned long aKey,
|
|
|
|
inout boolean aReady);
|
|
|
|
// Return the key that is used to randomize the collisions in the prefixes.
|
|
|
|
PRUint32 getKey();
|
2011-09-08 13:16:59 -07:00
|
|
|
boolean isEmpty();
|
|
|
|
void loadFromFile(in nsIFile aFile);
|
|
|
|
void storeToFile(in nsIFile aFile);
|
2011-09-08 13:15:08 -07:00
|
|
|
};
|