Back to index

lightning-sunbird  0.9+nobinonly
pager.h
Go to the documentation of this file.
00001 /*
00002 ** 2001 September 15
00003 **
00004 ** The author disclaims copyright to this source code.  In place of
00005 ** a legal notice, here is a blessing:
00006 **
00007 **    May you do good and not evil.
00008 **    May you find forgiveness for yourself and forgive others.
00009 **    May you share freely, never taking more than you give.
00010 **
00011 *************************************************************************
00012 ** This header file defines the interface that the sqlite page cache
00013 ** subsystem.  The page cache subsystem reads and writes a file a page
00014 ** at a time and provides a journal for rollback.
00015 **
00016 ** @(#) $Id: pager.h,v 1.50 2006/03/06 18:23:17 drh Exp $
00017 */
00018 
00019 #ifndef _PAGER_H_
00020 #define _PAGER_H_
00021 
00022 /*
00023 ** The default size of a database page.
00024 */
00025 #ifndef SQLITE_DEFAULT_PAGE_SIZE
00026 # define SQLITE_DEFAULT_PAGE_SIZE 1024
00027 #endif
00028 
00029 /* Maximum page size.  The upper bound on this value is 32768.  This a limit
00030 ** imposed by necessity of storing the value in a 2-byte unsigned integer
00031 ** and the fact that the page size must be a power of 2.
00032 **
00033 ** This value is used to initialize certain arrays on the stack at
00034 ** various places in the code.  On embedded machines where stack space
00035 ** is limited and the flexibility of having large pages is not needed,
00036 ** it makes good sense to reduce the maximum page size to something more
00037 ** reasonable, like 1024.
00038 */
00039 #ifndef SQLITE_MAX_PAGE_SIZE
00040 # define SQLITE_MAX_PAGE_SIZE 32768
00041 #endif
00042 
00043 /*
00044 ** Maximum number of pages in one database.
00045 */
00046 #define SQLITE_MAX_PAGE 1073741823
00047 
00048 /*
00049 ** The type used to represent a page number.  The first page in a file
00050 ** is called page 1.  0 is used to represent "not a page".
00051 */
00052 typedef unsigned int Pgno;
00053 
00054 /*
00055 ** Each open file is managed by a separate instance of the "Pager" structure.
00056 */
00057 typedef struct Pager Pager;
00058 
00059 /*
00060 ** Allowed values for the flags parameter to sqlite3pager_open().
00061 **
00062 ** NOTE: This values must match the corresponding BTREE_ values in btree.h.
00063 */
00064 #define PAGER_OMIT_JOURNAL  0x0001    /* Do not use a rollback journal */
00065 #define PAGER_NO_READLOCK   0x0002    /* Omit readlocks on readonly files */
00066 
00067 
00068 /*
00069 ** See source code comments for a detailed description of the following
00070 ** routines:
00071 */
00072 int sqlite3pager_open(Pager **ppPager, const char *zFilename,
00073                      int nExtra, int flags);
00074 void sqlite3pager_set_busyhandler(Pager*, BusyHandler *pBusyHandler);
00075 void sqlite3pager_set_destructor(Pager*, void(*)(void*,int));
00076 void sqlite3pager_set_reiniter(Pager*, void(*)(void*,int));
00077 int sqlite3pager_set_pagesize(Pager*, int);
00078 void sqlite3pager_read_fileheader(Pager*, int, unsigned char*);
00079 void sqlite3pager_set_cachesize(Pager*, int);
00080 int sqlite3pager_close(Pager *pPager);
00081 int sqlite3pager_get(Pager *pPager, Pgno pgno, void **ppPage);
00082 void *sqlite3pager_lookup(Pager *pPager, Pgno pgno);
00083 int sqlite3pager_ref(void*);
00084 int sqlite3pager_unref(void*);
00085 Pgno sqlite3pager_pagenumber(void*);
00086 int sqlite3pager_write(void*);
00087 int sqlite3pager_iswriteable(void*);
00088 int sqlite3pager_overwrite(Pager *pPager, Pgno pgno, void*);
00089 int sqlite3pager_pagecount(Pager*);
00090 int sqlite3pager_truncate(Pager*,Pgno);
00091 int sqlite3pager_begin(void*, int exFlag);
00092 int sqlite3pager_commit(Pager*);
00093 int sqlite3pager_sync(Pager*,const char *zMaster, Pgno);
00094 int sqlite3pager_rollback(Pager*);
00095 int sqlite3pager_isreadonly(Pager*);
00096 int sqlite3pager_stmt_begin(Pager*);
00097 int sqlite3pager_stmt_commit(Pager*);
00098 int sqlite3pager_stmt_rollback(Pager*);
00099 void sqlite3pager_dont_rollback(void*);
00100 void sqlite3pager_dont_write(Pager*, Pgno);
00101 int *sqlite3pager_stats(Pager*);
00102 void sqlite3pager_set_safety_level(Pager*,int,int);
00103 const char *sqlite3pager_filename(Pager*);
00104 const char *sqlite3pager_dirname(Pager*);
00105 const char *sqlite3pager_journalname(Pager*);
00106 int sqlite3pager_nosync(Pager*);
00107 int sqlite3pager_rename(Pager*, const char *zNewName);
00108 void sqlite3pager_set_codec(Pager*,void*(*)(void*,void*,Pgno,int),void*);
00109 int sqlite3pager_movepage(Pager*,void*,Pgno);
00110 int sqlite3pager_reset(Pager*);
00111 int sqlite3pager_release_memory(int);
00112 int sqlite3pager_loadall(Pager*);
00113 
00114 #if defined(SQLITE_DEBUG) || defined(SQLITE_TEST)
00115 int sqlite3pager_lockstate(Pager*);
00116 #endif
00117 
00118 #ifdef SQLITE_TEST
00119 void sqlite3pager_refdump(Pager*);
00120 int pager3_refinfo_enable;
00121 #endif
00122 
00123 #endif /* _PAGER_H_ */