blob: f12fe09a659f437ed896d06584a1eed5d6973ab7 [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**
drh72f82862001-05-24 21:06:34 +000028** @(#) $Id: pager.h,v 1.4 2001/05/24 21:06:36 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/*
37** The type used to represent a page number. The first page in a file
38** is called page 1. 0 is used to represent "not a page".
39*/
40typedef unsigned int Pgno;
41
42/*
43** Each open file is managed by a separate instance of the "Pager" structure.
44*/
45typedef struct Pager Pager;
46
drh72f82862001-05-24 21:06:34 +000047int sqlitepager_open(Pager **ppPager,const char *zFilename,int nPage,int nEx);
48void sqiltepager_set_destructor(Pager*, void(*)(void*));
drhd9b02572001-04-15 00:37:09 +000049int sqlitepager_close(Pager *pPager);
50int sqlitepager_get(Pager *pPager, Pgno pgno, void **ppPage);
drh7e3b0a02001-04-28 16:52:40 +000051void *sqlitepager_lookup(Pager *pPager, Pgno pgno);
drhd9b02572001-04-15 00:37:09 +000052int sqlitepager_unref(void*);
53Pgno sqlitepager_pagenumber(void*);
54int sqlitepager_write(void*);
55int sqlitepager_pagecount(Pager*);
56int sqlitepager_commit(Pager*);
57int sqlitepager_rollback(Pager*);
drhd9b02572001-04-15 00:37:09 +000058int *sqlitepager_stats(Pager*);