blob: 403ace1da0ea72d56ad0ccea6e4313b85180450f [file] [log] [blame]
drh960e8c62001-04-03 16:53:21 +00001/*
drhb19a2bc2001-09-16 00:13:26 +00002** 2001 September 15
drh960e8c62001-04-03 16:53:21 +00003**
drhb19a2bc2001-09-16 00:13:26 +00004** The author disclaims copyright to this source code. In place of
5** a legal notice, here is a blessing:
drh960e8c62001-04-03 16:53:21 +00006**
drhb19a2bc2001-09-16 00:13:26 +00007** May you do good and not evil.
8** May you find forgiveness for yourself and forgive others.
9** May you share freely, never taking more than you give.
drh960e8c62001-04-03 16:53:21 +000010**
11*************************************************************************
12** This header file defines the interface that the sqlite page cache
13** subsystem. The page cache subsystem reads and writes a file a page
14** at a time and provides a journal for rollback.
15**
drhfa86c412002-02-02 15:01:15 +000016** @(#) $Id: pager.h,v 1.14 2002/02/02 15:01:16 drh Exp $
drh960e8c62001-04-03 16:53:21 +000017*/
drh960e8c62001-04-03 16:53:21 +000018
19/*
20** The size of one page
drh58a11682001-11-10 13:51:08 +000021**
22** You can change this value to another (reasonable) power of two
23** such as 512, 2048, 4096, or 8192 and things will still work. But
24** experiments show that a page size of 1024 gives the best speed.
25** (The speed differences are minimal.)
drh960e8c62001-04-03 16:53:21 +000026*/
27#define SQLITE_PAGE_SIZE 1024
28
29/*
drh092d0352001-09-15 13:15:12 +000030** Maximum number of pages in one database. (This is a limitation of
31** imposed by 4GB files size limits.)
32*/
33#define SQLITE_MAX_PAGE 1073741823
34
35/*
drh960e8c62001-04-03 16:53:21 +000036** The type used to represent a page number. The first page in a file
37** is called page 1. 0 is used to represent "not a page".
38*/
39typedef unsigned int Pgno;
40
41/*
42** Each open file is managed by a separate instance of the "Pager" structure.
43*/
44typedef struct Pager Pager;
45
drh6446c4d2001-12-15 14:22:18 +000046/*
47** See source code comments for a detailed description of the following
48** routines:
49*/
drh72f82862001-05-24 21:06:34 +000050int sqlitepager_open(Pager **ppPager,const char *zFilename,int nPage,int nEx);
drh8c42ca92001-06-22 19:15:00 +000051void sqlitepager_set_destructor(Pager*, void(*)(void*));
drhf57b14a2001-09-14 18:54:08 +000052void sqlitepager_set_cachesize(Pager*, int);
drhd9b02572001-04-15 00:37:09 +000053int sqlitepager_close(Pager *pPager);
54int sqlitepager_get(Pager *pPager, Pgno pgno, void **ppPage);
drh7e3b0a02001-04-28 16:52:40 +000055void *sqlitepager_lookup(Pager *pPager, Pgno pgno);
drh8c42ca92001-06-22 19:15:00 +000056int sqlitepager_ref(void*);
drhd9b02572001-04-15 00:37:09 +000057int sqlitepager_unref(void*);
58Pgno sqlitepager_pagenumber(void*);
59int sqlitepager_write(void*);
drh6019e162001-07-02 17:51:45 +000060int sqlitepager_iswriteable(void*);
drhd9b02572001-04-15 00:37:09 +000061int sqlitepager_pagecount(Pager*);
62int sqlitepager_commit(Pager*);
63int sqlitepager_rollback(Pager*);
drh5e00f6c2001-09-13 13:46:56 +000064int sqlitepager_isreadonly(Pager*);
drhfa86c412002-02-02 15:01:15 +000065int sqlitepager_ckpt_begin(Pager*);
66int sqlitepager_ckpt_commit(Pager*);
67int sqlitepager_ckpt_rollback(Pager*);
drhd9b02572001-04-15 00:37:09 +000068int *sqlitepager_stats(Pager*);
drhdd793422001-06-28 01:54:48 +000069
70#ifdef SQLITE_TEST
71void sqlitepager_refdump(Pager*);
72int pager_refinfo_enable;
73#endif