storage/public/mozIStorageVacuumParticipant.idl

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/storage/public/mozIStorageVacuumParticipant.idl	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,57 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
     1.5 + * vim: sw=2 ts=2 et lcs=trail\:.,tab\:>~ :
     1.6 + * This Source Code Form is subject to the terms of the Mozilla Public
     1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.9 +
    1.10 +#include "nsISupports.idl"
    1.11 +
    1.12 +interface mozIStorageConnection;
    1.13 +
    1.14 +/**
    1.15 + * This interface contains the information that the Storage service needs to
    1.16 + * vacuum a database.  This interface is created as a service through the
    1.17 + * category manager with the category "vacuum-participant".
    1.18 + * Please see https://developer.mozilla.org/en/mozIStorageVacuumParticipant for
    1.19 + * more information.
    1.20 + */
    1.21 +[scriptable, uuid(8f367508-1d9a-4d3f-be0c-ac11b6dd7dbf)]
    1.22 +interface mozIStorageVacuumParticipant : nsISupports {
    1.23 +  /**
    1.24 +   * The expected page size in bytes for the database.  The vacuum manager will
    1.25 +   * try to correct the page size during idle based on this value.
    1.26 +   *
    1.27 +   * @note If the database is using the WAL journal mode, the page size won't
    1.28 +  *        be changed to the requested value.  See bug 634374.
    1.29 +   * @note Valid page size values are powers of 2 between 512 and 65536.
    1.30 +   *       The suggested value is mozIStorageConnection::defaultPageSize.
    1.31 +   */
    1.32 +  readonly attribute long expectedDatabasePageSize;
    1.33 +
    1.34 +  /**
    1.35 +   * Connection to the database file to be vacuumed.
    1.36 +   */
    1.37 +  readonly attribute mozIStorageConnection databaseConnection;
    1.38 +
    1.39 +  /**
    1.40 +   * Notifies when a vacuum operation begins.  Listeners should avoid using the
    1.41 +   * database till onEndVacuum is received.
    1.42 +   *
    1.43 +   * @return true to proceed with the vacuum, false if the participant wants to
    1.44 +   *         opt-out for now, it will be retried later.  Useful when participant
    1.45 +   *         is running some other heavy operation that can't be interrupted.
    1.46 +   *
    1.47 +   * @note When a vacuum operation starts or ends it will also dispatch a global
    1.48 +   *       "heavy-io-task" notification through the observer service with the
    1.49 +   *       data argument being either "vacuum-begin" or "vacuum-end".
    1.50 +   */
    1.51 +  boolean onBeginVacuum();
    1.52 +
    1.53 +  /**
    1.54 +   * Notifies when a vacuum operation ends.
    1.55 +   *
    1.56 +   * @param aSucceeded
    1.57 +   *        reports if the vacuum succeeded or failed.
    1.58 +   */
    1.59 +  void onEndVacuum(in boolean aSucceeded);
    1.60 +};

mercurial