1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6#include "nsISupports.idl"
7#include "nsIUrlClassifierDBService.idl"
8
9/**
10 * This is a class to manage large table updates from the server.  Rather than
11 * downloading the whole update and then updating the sqlite database, we
12 * update tables as the data is streaming in.
13 */
14[scriptable, uuid(e1797597-f4d6-4dd3-a1e1-745ad352cd80)]
15interface nsIUrlClassifierStreamUpdater : nsISupports
16{
17  /**
18   * Try to download updates from updateUrl. If an update is already in
19   * progress, queues the requested update. This is used in nsIUrlListManager
20   * as well as in testing.
21   * @param aRequestTables Comma-separated list of tables included in this
22   *        update.
23   * @param aRequestPayload The payload for the request.
24   * @param aIsPostRequest Whether the request should be sent by POST method.
25   *                       Should be 'true' for v2 usage.
26   * @param aUpdateUrl The plaintext url from which to request updates.
27   * @param aSuccessCallback Called after a successful update.
28   * @param aUpdateErrorCallback Called for problems applying the update
29   * @param aDownloadErrorCallback Called if we get an http error or a
30   *        connection refused error.
31   */
32  boolean downloadUpdates(in ACString aRequestTables,
33                          in ACString aRequestPayload,
34                          in boolean aIsPostRequest,
35                          in ACString aUpdateUrl,
36                          in nsIUrlClassifierCallback aSuccessCallback,
37                          in nsIUrlClassifierCallback aUpdateErrorCallback,
38                          in nsIUrlClassifierCallback aDownloadErrorCallback);
39};
40