blob: 0e72715fe5b60662877f549ca65e6efae850326d [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**
drhb19a2bc2001-09-16 00:13:26 +000016** @(#) $Id: pager.h,v 1.11 2001/09/16 00:13:27 drh Exp $
drh960e8c62001-04-03 16:53:21 +000017*/
drh960e8c62001-04-03 16:53:21 +000018
19/*
20** The size of one page
21*/
22#define SQLITE_PAGE_SIZE 1024
23
24/*
drh092d0352001-09-15 13:15:12 +000025** Maximum number of pages in one database. (This is a limitation of
26** imposed by 4GB files size limits.)
27*/
28#define SQLITE_MAX_PAGE 1073741823
29
30/*
drh960e8c62001-04-03 16:53:21 +000031** The type used to represent a page number. The first page in a file
32** is called page 1. 0 is used to represent "not a page".
33*/
34typedef unsigned int Pgno;
35
36/*
37** Each open file is managed by a separate instance of the "Pager" structure.
38*/
39typedef struct Pager Pager;
40
drh72f82862001-05-24 21:06:34 +000041int sqlitepager_open(Pager **ppPager,const char *zFilename,int nPage,int nEx);
drh8c42ca92001-06-22 19:15:00 +000042void sqlitepager_set_destructor(Pager*, void(*)(void*));
drhf57b14a2001-09-14 18:54:08 +000043void sqlitepager_set_cachesize(Pager*, int);
drhd9b02572001-04-15 00:37:09 +000044int sqlitepager_close(Pager *pPager);
45int sqlitepager_get(Pager *pPager, Pgno pgno, void **ppPage);
drh7e3b0a02001-04-28 16:52:40 +000046void *sqlitepager_lookup(Pager *pPager, Pgno pgno);
drh8c42ca92001-06-22 19:15:00 +000047int sqlitepager_ref(void*);
drhd9b02572001-04-15 00:37:09 +000048int sqlitepager_unref(void*);
49Pgno sqlitepager_pagenumber(void*);
50int sqlitepager_write(void*);
drh6019e162001-07-02 17:51:45 +000051int sqlitepager_iswriteable(void*);
drhd9b02572001-04-15 00:37:09 +000052int sqlitepager_pagecount(Pager*);
53int sqlitepager_commit(Pager*);
54int sqlitepager_rollback(Pager*);
drh5e00f6c2001-09-13 13:46:56 +000055int sqlitepager_isreadonly(Pager*);
drhd9b02572001-04-15 00:37:09 +000056int *sqlitepager_stats(Pager*);
drhdd793422001-06-28 01:54:48 +000057
58#ifdef SQLITE_TEST
59void sqlitepager_refdump(Pager*);
60int pager_refinfo_enable;
61#endif