-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
-C Update\sthe\squota\sshim\sso\sthat\swhen\sthe\ssame\sfile\sis\sopened\smultiple\stimes,\nits\ssize\sonly\scounts\sagainst\sthe\squota\sonce.
-D 2010-09-01T12:50:54
+C Clean\sup\scomments\sin\sthe\stest_quota.c\ssource\sfile.
+D 2010-09-01T13:09:57
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in c599a15d268b1db2aeadea19df2adc3bf2eb6bee
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
F src/test_onefile.c 40cf9e212a377a6511469384a64b01e6e34b2eec
F src/test_osinst.c f408c6a181f2fb04c56273afd5c3e1e82f60392c
F src/test_pcache.c 7bf828972ac0d2403f5cfa4cd14da41f8ebe73d8
-F src/test_quota.c 3bd9629e4b88d1aa7086a987a7eaee35d8683280
+F src/test_quota.c e542d96d5e0ad7bbc064ab9912da3d8ed65cbe28
F src/test_rtree.c e957a603a98871dcf005c1e96ae791cfe74eb7f6
F src/test_schema.c 8c06ef9ddb240c7a0fcd31bc221a6a2aade58bf0
F src/test_server.c bbba05c144b5fc4b52ff650a4328027b3fa5fcc6
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
-P 383eb87bbf560b20682dd5be0e18ddadf762f415
-R b5a4d36b9d6562d3c3442739bfabc1f0
+P f5d263803084107389c5541face8d536b62fffe3
+R 35c143fcc0c1d935b095e49fe0b10b28
U drh
-Z 71992168532d47edde2bb9ee2fe75389
+Z 22044fa4707460c35e1dd2a52d813a99
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
-iD8DBQFMfkwxoxKgR168RlERAgANAJ9B4KtMV72Ji0JYDm0FJNxZrpK+kwCfT8lT
-0hQEz4MNPkLhC93D3DNoV70=
-=rL9o
+iD8DBQFMflCroxKgR168RlERAupSAJ41VgmVbutErFMPzEt158JfEp4N/gCeLiry
+ne2YPJhXeQQSv7tL27HzCOk=
+=nNgv
-----END PGP SIGNATURE-----
typedef struct quotaFile quotaFile;
/*
-** This module contains a table of filename patterns that have size
-** quotas. The quota applies to the sum of the sizes of all open
-** database files whose names match the GLOB pattern.
+** A "quota group" is a collection of files whose collective size we want
+** to limit. Each quota group is defined by a GLOB pattern.
**
-** Each quota is an instance of the following object. Quotas must
-** be established (using sqlite3_quota_set()) prior to opening any
-** of the database connections that access files governed by the
-** quota.
+** There is an instance of the following object for each defined quota
+** group. This object records the GLOB pattern that defines which files
+** belong to the quota group. The object also remembers the size limit
+** for the group (the quota) and the callback to be invoked when the
+** sum of the sizes of the files within the group goes over the limit.
**
-** Each entry in the quota table is an instance of the following object.
+** A quota group must be established (using sqlite3_quota_set(...))
+** prior to opening any of the database connections that access files
+** within the quota group.
*/
struct quotaGroup {
const char *zPattern; /* Filename pattern to be quotaed */
** An instance of this structure represents a single file that is part
** of a quota group. A single file can be opened multiple times. In
** order keep multiple openings of the same file from causing the size
-** of the file counting against the quota multiple times, each file
+** of the file to count against the quota multiple times, each file
** has a unique instance of this object and multiple open connections
** to the same file each point to a single instance of this object.
*/
/*
** An instance of the following object represents each open connection
-** to a file that participates in quota tracking. The sqlite3_file object
-** for the underlying VFS is appended to this structure.
+** to a file that participates in quota tracking. This object is a
+** subclass of sqlite3_file. The sqlite3_file object for the underlying
+** VFS is appended to this structure.
*/
struct quotaOpen {
sqlite3_file base; /* Base class - must be first */
** gQuota structure.
*/
static struct {
- /* The pOrigVfs is a pointer to the real underlying VFS implementation.
+ /* The pOrigVfs is the real, original underlying VFS implementation.
** Most operations pass-through to the real VFS. This value is read-only
** during operation. It is only modified at start-time and thus does not
** require a mutex.
}
/* Translate an sqlite3_file* that is really a quotaOpen* into
-** an sqlite3_file* for the underlying original VFS.
+** the sqlite3_file* for the underlying original VFS.
*/
static sqlite3_file *quotaSubOpen(sqlite3_file *pOpen){
quotaOpen *p = (quotaOpen*)pOpen;
** This is the xOpen method used for the "quota" VFS.
**
** Most of the work is done by the underlying original VFS. This method
-** simply links the new file into the quota group if it is a file that
-** needs to be tracked.
+** simply links the new file into the appropriate quota group if it is a
+** file that needs to be tracked.
*/
static int quotaxOpen(
- sqlite3_vfs *pVfs,
- const char *zName,
- sqlite3_file *pOpen,
- int flags,
- int *pOutFlags
+ sqlite3_vfs *pVfs, /* The quota VFS */
+ const char *zName, /* Name of file to be opened */
+ sqlite3_file *pOpen, /* Fill in this file descriptor */
+ int flags, /* Flags to control the opening */
+ int *pOutFlags /* Flags showing results of opening */
){
- int rc;
- quotaOpen *pQuotaOpen;
- quotaFile *pFile;
- quotaGroup *pGroup;
- sqlite3_file *pSubOpen;
- sqlite3_vfs *pOrigVfs = gQuota.pOrigVfs;
+ int rc; /* Result code */
+ quotaOpen *pQuotaOpen; /* The new quota file descriptor */
+ quotaFile *pFile; /* Corresponding quotaFile obj */
+ quotaGroup *pGroup; /* The group file belongs to */
+ sqlite3_file *pSubOpen; /* Real file descriptor */
+ sqlite3_vfs *pOrigVfs = gQuota.pOrigVfs; /* Real VFS */
/* If the file is not a main database file or a WAL, then use the
** normal xOpen method.