blob: 363704658578350bb0f2e89a1e58f10e3df12305 [file] [log] [blame]
drh960e8c62001-04-03 16:53:21 +00001/*
2** Copyright (c) 2001 D. Richard Hipp
3**
4** This program is free software; you can redistribute it and/or
5** modify it under the terms of the GNU General Public
6** License as published by the Free Software Foundation; either
7** version 2 of the License, or (at your option) any later version.
8**
9** This program is distributed in the hope that it will be useful,
10** but WITHOUT ANY WARRANTY; without even the implied warranty of
11** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12** General Public License for more details.
13**
14** You should have received a copy of the GNU General Public
15** License along with this library; if not, write to the
16** Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17** Boston, MA 02111-1307, USA.
18**
19** Author contact information:
20** drh@hwaci.com
21** http://www.hwaci.com/drh/
22**
23*************************************************************************
24** This header file defines the interface that the sqlite page cache
25** subsystem. The page cache subsystem reads and writes a file a page
26** at a time and provides a journal for rollback.
27**
drh092d0352001-09-15 13:15:12 +000028** @(#) $Id: pager.h,v 1.10 2001/09/15 13:15:13 drh Exp $
drh960e8c62001-04-03 16:53:21 +000029*/
drh960e8c62001-04-03 16:53:21 +000030
31/*
32** The size of one page
33*/
34#define SQLITE_PAGE_SIZE 1024
35
36/*
drh092d0352001-09-15 13:15:12 +000037** Maximum number of pages in one database. (This is a limitation of
38** imposed by 4GB files size limits.)
39*/
40#define SQLITE_MAX_PAGE 1073741823
41
42/*
drh960e8c62001-04-03 16:53:21 +000043** The type used to represent a page number. The first page in a file
44** is called page 1. 0 is used to represent "not a page".
45*/
46typedef unsigned int Pgno;
47
48/*
49** Each open file is managed by a separate instance of the "Pager" structure.
50*/
51typedef struct Pager Pager;
52
drh72f82862001-05-24 21:06:34 +000053int sqlitepager_open(Pager **ppPager,const char *zFilename,int nPage,int nEx);
drh8c42ca92001-06-22 19:15:00 +000054void sqlitepager_set_destructor(Pager*, void(*)(void*));
drhf57b14a2001-09-14 18:54:08 +000055void sqlitepager_set_cachesize(Pager*, int);
drhd9b02572001-04-15 00:37:09 +000056int sqlitepager_close(Pager *pPager);
57int sqlitepager_get(Pager *pPager, Pgno pgno, void **ppPage);
drh7e3b0a02001-04-28 16:52:40 +000058void *sqlitepager_lookup(Pager *pPager, Pgno pgno);
drh8c42ca92001-06-22 19:15:00 +000059int sqlitepager_ref(void*);
drhd9b02572001-04-15 00:37:09 +000060int sqlitepager_unref(void*);
61Pgno sqlitepager_pagenumber(void*);
62int sqlitepager_write(void*);
drh6019e162001-07-02 17:51:45 +000063int sqlitepager_iswriteable(void*);
drhd9b02572001-04-15 00:37:09 +000064int sqlitepager_pagecount(Pager*);
65int sqlitepager_commit(Pager*);
66int sqlitepager_rollback(Pager*);
drh5e00f6c2001-09-13 13:46:56 +000067int sqlitepager_isreadonly(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