blob: e1a09adbf5e761471781184ed56d2a221f908d4c [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**
drhda47d772002-12-02 04:25:19 +000016** @(#) $Id: pager.h,v 1.18 2002/12/02 04:25:21 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*/
drhda47d772002-12-02 04:25:19 +000050int sqlitepager_open(Pager **ppPager, const char *zFilename,
51 int nPage, int nExtra, int useJournal);
drh8c42ca92001-06-22 19:15:00 +000052void sqlitepager_set_destructor(Pager*, void(*)(void*));
drhf57b14a2001-09-14 18:54:08 +000053void sqlitepager_set_cachesize(Pager*, int);
drhd9b02572001-04-15 00:37:09 +000054int sqlitepager_close(Pager *pPager);
55int sqlitepager_get(Pager *pPager, Pgno pgno, void **ppPage);
drh7e3b0a02001-04-28 16:52:40 +000056void *sqlitepager_lookup(Pager *pPager, Pgno pgno);
drh8c42ca92001-06-22 19:15:00 +000057int sqlitepager_ref(void*);
drhd9b02572001-04-15 00:37:09 +000058int sqlitepager_unref(void*);
59Pgno sqlitepager_pagenumber(void*);
60int sqlitepager_write(void*);
drh6019e162001-07-02 17:51:45 +000061int sqlitepager_iswriteable(void*);
drhd9b02572001-04-15 00:37:09 +000062int sqlitepager_pagecount(Pager*);
drh4b845d72002-03-05 12:41:19 +000063int sqlitepager_begin(void*);
drhd9b02572001-04-15 00:37:09 +000064int sqlitepager_commit(Pager*);
65int sqlitepager_rollback(Pager*);
drh5e00f6c2001-09-13 13:46:56 +000066int sqlitepager_isreadonly(Pager*);
drhfa86c412002-02-02 15:01:15 +000067int sqlitepager_ckpt_begin(Pager*);
68int sqlitepager_ckpt_commit(Pager*);
69int sqlitepager_ckpt_rollback(Pager*);
drh30e58752002-03-02 20:41:57 +000070void sqlitepager_dont_rollback(void*);
71void sqlitepager_dont_write(Pager*, Pgno);
drhd9b02572001-04-15 00:37:09 +000072int *sqlitepager_stats(Pager*);
drhdd793422001-06-28 01:54:48 +000073
74#ifdef SQLITE_TEST
75void sqlitepager_refdump(Pager*);
76int pager_refinfo_enable;
drh94f33312002-08-12 12:29:56 +000077int pager_old_format;
drhdd793422001-06-28 01:54:48 +000078#endif