2010-09-03 07:41:55 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=2 et sw=2 tw=80: */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
|
|
*
|
|
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
* the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/MPL/
|
|
|
|
*
|
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
|
|
|
*
|
|
|
|
* The Original Code is Indexed Database.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is
|
|
|
|
* The Mozilla Foundation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 2010
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
|
|
|
* Ben Turner <bent.mozilla@gmail.com>
|
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
|
|
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
|
|
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
|
|
|
|
|
|
|
#include "nsISupports.idl"
|
|
|
|
|
|
|
|
interface mozIStorageConnection;
|
|
|
|
interface nsIFile;
|
|
|
|
|
|
|
|
[scriptable, function, uuid(ae94f0a5-ebdf-48f4-9959-085e13235d8d)]
|
|
|
|
interface mozIStorageQuotaCallback : nsISupports
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Called when the file size quota for a group of databases is exceeded.
|
|
|
|
*
|
|
|
|
* @param aFilename
|
|
|
|
* The filename of the database that has exceeded the quota.
|
|
|
|
*
|
|
|
|
* @param aCurrentSizeLimit
|
|
|
|
* The current size (in bytes) of the quota.
|
|
|
|
*
|
|
|
|
* @param aCurrentTotalSize
|
|
|
|
* The current size of all databases in the quota group.
|
|
|
|
*
|
|
|
|
* @param aUserData
|
|
|
|
* Any additional data that was provided to the
|
|
|
|
* setQuotaForFilenamePattern function.
|
|
|
|
*
|
|
|
|
* @returns A new quota size. A new quota of 0 will disable the quota callback
|
|
|
|
* and any quota value less than aCurrentTotalSize will cause the
|
|
|
|
* database operation to fail with NS_ERROR_FILE_NO_DEVICE_SPACE.
|
|
|
|
*/
|
|
|
|
long long quotaExceeded(in ACString aFilename,
|
|
|
|
in long long aCurrentSizeLimit,
|
|
|
|
in long long aCurrentTotalSize,
|
|
|
|
in nsISupports aUserData);
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This is a temporary interface that should eventually merge with
|
|
|
|
* mozIStorageService.
|
|
|
|
*/
|
2011-12-15 23:34:24 -08:00
|
|
|
[scriptable, uuid(4d81faf5-fe01-428b-99b8-c94cba12fd72)]
|
2010-09-03 07:41:55 -07:00
|
|
|
interface mozIStorageServiceQuotaManagement : nsISupports
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* See mozIStorageService.openDatabase. Exactly the same only with a custom
|
|
|
|
* SQLite VFS.
|
|
|
|
*/
|
|
|
|
mozIStorageConnection openDatabaseWithVFS(in nsIFile aDatabaseFile,
|
|
|
|
in ACString aVFSName);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set a file size quota for a group of databases matching the given filename
|
|
|
|
* pattern, optionally specifying a callback when the quota is exceeded.
|
|
|
|
*
|
|
|
|
* @param aPattern
|
|
|
|
* A pattern to match filenames for inclusion in the quota system. May
|
|
|
|
* contain the following special characters:
|
|
|
|
* '*' Matches any sequence of zero or more characters.
|
|
|
|
* '?' Matches exactly one character.
|
|
|
|
* [...] Matches one character from the enclosed list of characters.
|
|
|
|
* [^...] Matches one character not in the enclosed list.
|
|
|
|
*
|
|
|
|
* @param aSizeLimit
|
|
|
|
* The size limit (in bytes) for the quota group.
|
|
|
|
*
|
|
|
|
* @param aCallback
|
|
|
|
* A callback that will be used when the quota is exceeded.
|
|
|
|
*
|
|
|
|
* @param aUserData
|
|
|
|
* Additional information to be passed to the callback.
|
|
|
|
*/
|
|
|
|
void setQuotaForFilenamePattern(in ACString aPattern,
|
|
|
|
in long long aSizeLimit,
|
|
|
|
in mozIStorageQuotaCallback aCallback,
|
|
|
|
in nsISupports aUserData);
|
2011-08-26 01:21:35 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Adds, removes, or updates the file size information maintained by the quota
|
|
|
|
* system for files not opened through openDatabaseWithVFS().
|
|
|
|
*
|
|
|
|
* Use this function when you want files to be included in quota calculations
|
|
|
|
* that are either a) not SQLite databases, or b) SQLite databases that have
|
|
|
|
* not been opened.
|
|
|
|
*
|
|
|
|
* This function will have no effect on files that do not match an existing
|
|
|
|
* quota pattern (set previously by setQuotaForFilenamePattern()).
|
|
|
|
*
|
|
|
|
* @param aFile
|
|
|
|
* The file for which quota information should be updated. If the file
|
|
|
|
* exists then its size information will be added or refreshed. If the
|
|
|
|
* file does not exist then the file will be removed from tracking
|
|
|
|
* under the quota system.
|
|
|
|
*/
|
2011-12-15 23:34:24 -08:00
|
|
|
void updateQuotaInformationForFile(in nsIFile aFile);
|
2010-09-03 07:41:55 -07:00
|
|
|
};
|