annotate sqlite/pager.h @ 1507:0c5fdcf3f947 trunk

[svn] - incomplete stuff
author nenolod
date Sun, 06 Aug 2006 01:53:29 -0700
parents b6b61becdf4e
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1434
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
1 /*
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
2 ** 2001 September 15
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
3 **
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
4 ** The author disclaims copyright to this source code. In place of
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
5 ** a legal notice, here is a blessing:
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
6 **
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
7 ** May you do good and not evil.
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
8 ** May you find forgiveness for yourself and forgive others.
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
9 ** May you share freely, never taking more than you give.
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
10 **
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
11 *************************************************************************
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
12 ** This header file defines the interface that the sqlite page cache
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
13 ** subsystem. The page cache subsystem reads and writes a file a page
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
14 ** at a time and provides a journal for rollback.
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
15 **
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
16 ** @(#) $Id: pager.h,v 1.50 2006/03/06 18:23:17 drh Exp $
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
17 */
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
18
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
19 #ifndef _PAGER_H_
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
20 #define _PAGER_H_
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
21
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
22 /*
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
23 ** The default size of a database page.
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
24 */
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
25 #ifndef SQLITE_DEFAULT_PAGE_SIZE
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
26 # define SQLITE_DEFAULT_PAGE_SIZE 1024
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
27 #endif
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
28
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
29 /* Maximum page size. The upper bound on this value is 32768. This a limit
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
30 ** imposed by necessity of storing the value in a 2-byte unsigned integer
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
31 ** and the fact that the page size must be a power of 2.
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
32 **
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
33 ** This value is used to initialize certain arrays on the stack at
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
34 ** various places in the code. On embedded machines where stack space
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
35 ** is limited and the flexibility of having large pages is not needed,
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
36 ** it makes good sense to reduce the maximum page size to something more
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
37 ** reasonable, like 1024.
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
38 */
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
39 #ifndef SQLITE_MAX_PAGE_SIZE
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
40 # define SQLITE_MAX_PAGE_SIZE 32768
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
41 #endif
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
42
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
43 /*
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
44 ** Maximum number of pages in one database.
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
45 */
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
46 #define SQLITE_MAX_PAGE 1073741823
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
47
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
48 /*
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
49 ** The type used to represent a page number. The first page in a file
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
50 ** is called page 1. 0 is used to represent "not a page".
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
51 */
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
52 typedef unsigned int Pgno;
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
53
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
54 /*
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
55 ** Each open file is managed by a separate instance of the "Pager" structure.
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
56 */
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
57 typedef struct Pager Pager;
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
58
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
59 /*
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
60 ** Allowed values for the flags parameter to sqlite3pager_open().
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
61 **
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
62 ** NOTE: This values must match the corresponding BTREE_ values in btree.h.
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
63 */
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
64 #define PAGER_OMIT_JOURNAL 0x0001 /* Do not use a rollback journal */
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
65 #define PAGER_NO_READLOCK 0x0002 /* Omit readlocks on readonly files */
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
66
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
67
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
68 /*
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
69 ** See source code comments for a detailed description of the following
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
70 ** routines:
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
71 */
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
72 int sqlite3pager_open(Pager **ppPager, const char *zFilename,
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
73 int nExtra, int flags);
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
74 void sqlite3pager_set_busyhandler(Pager*, BusyHandler *pBusyHandler);
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
75 void sqlite3pager_set_destructor(Pager*, void(*)(void*,int));
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
76 void sqlite3pager_set_reiniter(Pager*, void(*)(void*,int));
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
77 int sqlite3pager_set_pagesize(Pager*, int);
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
78 void sqlite3pager_read_fileheader(Pager*, int, unsigned char*);
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
79 void sqlite3pager_set_cachesize(Pager*, int);
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
80 int sqlite3pager_close(Pager *pPager);
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
81 int sqlite3pager_get(Pager *pPager, Pgno pgno, void **ppPage);
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
82 void *sqlite3pager_lookup(Pager *pPager, Pgno pgno);
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
83 int sqlite3pager_ref(void*);
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
84 int sqlite3pager_unref(void*);
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
85 Pgno sqlite3pager_pagenumber(void*);
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
86 int sqlite3pager_write(void*);
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
87 int sqlite3pager_iswriteable(void*);
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
88 int sqlite3pager_overwrite(Pager *pPager, Pgno pgno, void*);
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
89 int sqlite3pager_pagecount(Pager*);
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
90 int sqlite3pager_truncate(Pager*,Pgno);
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
91 int sqlite3pager_begin(void*, int exFlag);
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
92 int sqlite3pager_commit(Pager*);
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
93 int sqlite3pager_sync(Pager*,const char *zMaster, Pgno);
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
94 int sqlite3pager_rollback(Pager*);
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
95 int sqlite3pager_isreadonly(Pager*);
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
96 int sqlite3pager_stmt_begin(Pager*);
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
97 int sqlite3pager_stmt_commit(Pager*);
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
98 int sqlite3pager_stmt_rollback(Pager*);
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
99 void sqlite3pager_dont_rollback(void*);
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
100 void sqlite3pager_dont_write(Pager*, Pgno);
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
101 int *sqlite3pager_stats(Pager*);
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
102 void sqlite3pager_set_safety_level(Pager*,int,int);
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
103 const char *sqlite3pager_filename(Pager*);
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
104 const char *sqlite3pager_dirname(Pager*);
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
105 const char *sqlite3pager_journalname(Pager*);
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
106 int sqlite3pager_nosync(Pager*);
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
107 int sqlite3pager_rename(Pager*, const char *zNewName);
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
108 void sqlite3pager_set_codec(Pager*,void*(*)(void*,void*,Pgno,int),void*);
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
109 int sqlite3pager_movepage(Pager*,void*,Pgno);
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
110 int sqlite3pager_reset(Pager*);
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
111 int sqlite3pager_release_memory(int);
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
112
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
113 #if defined(SQLITE_DEBUG) || defined(SQLITE_TEST)
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
114 int sqlite3pager_lockstate(Pager*);
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
115 #endif
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
116
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
117 #ifdef SQLITE_TEST
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
118 void sqlite3pager_refdump(Pager*);
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
119 int pager3_refinfo_enable;
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
120 #endif
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
121
b6b61becdf4e [svn] - add sqlite/ directory
nenolod
parents:
diff changeset
122 #endif /* _PAGER_H_ */