]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Add data structure description comments to memjournal.c. (CVS 5847)
authordrh <drh@noemail.net>
Tue, 28 Oct 2008 18:12:36 +0000 (18:12 +0000)
committerdrh <drh@noemail.net>
Tue, 28 Oct 2008 18:12:36 +0000 (18:12 +0000)
FossilOrigin-Name: e9c2adbcbf5c28837b06e0fbba93f1764cc3607f

manifest
manifest.uuid
src/memjournal.c

index f9a372b1275de459f713a958eb763b9f15f74f32..55c64858816a7e1c08c047ae48848e1e05625e54 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Avoid\sexposing\sinternal\sinterfaces\ssqlite_attach()\sand\ssqlite_detach()\sas\sSQL\sscalar\sfunctions.\sTicket\s#3466.\s(CVS\s5846)
-D 2008-10-28T17:52:39
+C Add\sdata\sstructure\sdescription\scomments\sto\smemjournal.c.\s(CVS\s5847)
+D 2008-10-28T18:12:36
 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
 F Makefile.in 3fe17eccd87d385b5adc9766828716cfdd154d6b
 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -126,7 +126,7 @@ F src/mem3.c 1594f117fde4cf11a6c16521f3f30af8d04bbe68
 F src/mem4.c 6703adb1717b26d9d70a1c2586b4b7b7ffee7909
 F src/mem5.c 706d462c13a9819dfec7c10d9dccedf8d199960c
 F src/mem6.c febe4db9ddef73df500989e68a9d4ac68602a075
-F src/memjournal.c b12b20d3441945e590b8dacdc6705d39e02ab33c
+F src/memjournal.c 7ffe4ebf5e7792571c27d528ca005e495343d1c4
 F src/mutex.c e9cb5fbe94afb4328869afaf3ac49bd1327559eb
 F src/mutex.h 9e686e83a88838dac8b9c51271c651e833060f1e
 F src/mutex_noop.c 0004efdbc2fd48d261d5b3416fe537e888c79a54
@@ -652,7 +652,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81
 F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
 F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
-P 65a2e131732399f0f14f982eb0689482fdb87b6c
-R 0cb9d60af76c276feb71e24e0ccd886d
-U danielk1977
-Z 104cd13ffd1795d54fed32e003437e94
+P 679c0b35aaa1ea488a205cc03802e7078a2bcf29
+R 8c08739effdbffeefaabe6ecfcdcebaf
+U drh
+Z 35d81495d6d4eb3c73d75e648d0cc22a
index 24dd89a79b3e0abf96c0d92e4f9a4d5a623f5dc0..ecefa85ba34b37a1383a12c4ea775042911d9228 100644 (file)
@@ -1 +1 @@
-679c0b35aaa1ea488a205cc03802e7078a2bcf29
\ No newline at end of file
+e9c2adbcbf5c28837b06e0fbba93f1764cc3607f
\ No newline at end of file
index f8e7d49bef23e06b2efda5de9b9e0ae40d16c5a1..88ee57e5b5aa132bd7d7390feff32e95892f8dc5 100644 (file)
@@ -1,5 +1,5 @@
 /*
-** 2007 August 22
+** 2008 October 7
 **
 ** The author disclaims copyright to this source code.  In place of
 ** a legal notice, here is a blessing:
 **
 *************************************************************************
 **
-** @(#) $Id: memjournal.c,v 1.1 2008/10/17 19:13:05 danielk1977 Exp $
+** This file contains code use to implement an in-memory rollback journal.
+** The in-memory rollback journal is used to journal transactions for
+** ":memory:" databases and when the journal_mode=MEMORY pragma is used.
+**
+** @(#) $Id: memjournal.c,v 1.2 2008/10/28 18:12:36 drh Exp $
 */
-
-
 #include "sqliteInt.h"
 
+/* Forward references to internal structures */
 typedef struct MemJournal MemJournal;
 typedef struct FilePoint FilePoint;
 typedef struct FileChunk FileChunk;
 
+/* Space to hold the rollback journal is allocated in increments of
+** this many bytes.
+*/
 #define JOURNAL_CHUNKSIZE 1024
 
+/* Macro to find the minimum of two numeric values.
+*/
 #define MIN(x,y) ((x)<(y)?(x):(y))
 
+/*
+** The rollback journal is composed of a linked list of these structures.
+*/
 struct FileChunk {
-  FileChunk *pNext;
-  u8 zChunk[JOURNAL_CHUNKSIZE];
+  FileChunk *pNext;               /* Next chunk in the journal */
+  u8 zChunk[JOURNAL_CHUNKSIZE];   /* Content of this chunk */
 };
 
+/*
+** An instance of this object serves as a cursor into the rollback journal.
+** The cursor can be either for reading or writing.
+*/
 struct FilePoint {
-  sqlite3_int64 iOffset;
-  FileChunk *pChunk;
+  sqlite3_int64 iOffset;          /* Offset from the beginning of the file */
+  FileChunk *pChunk;              /* Specific chunk into which cursor points */
 };
 
+/*
+** This subclass is a subclass of sqlite3_file.  Each open memory-journal
+** is an instance of this class.
+*/
 struct MemJournal {
-  sqlite3_io_methods *pMethod;    /* I/O methods on journal files */
+  sqlite3_io_methods *pMethod;    /* Parent class. MUST BE FIRST */
   FileChunk *pFirst;              /* Head of in-memory chunk-list */
   FilePoint endpoint;             /* Pointer to the end of the file */
   FilePoint readpoint;            /* Pointer to the end of the last xRead() */
@@ -219,5 +238,3 @@ int sqlite3IsMemJournal(sqlite3_file *pJfd){
 int sqlite3MemJournalSize(){
   return sizeof(MemJournal);
 }
-
-