drh | 960e8c6 | 2001-04-03 16:53:21 +0000 | [diff] [blame] | 1 | /* |
| 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 | ** |
drh | 7e3b0a0 | 2001-04-28 16:52:40 +0000 | [diff] [blame^] | 28 | ** @(#) $Id: pager.h,v 1.3 2001/04/28 16:52:42 drh Exp $ |
drh | 960e8c6 | 2001-04-03 16:53:21 +0000 | [diff] [blame] | 29 | */ |
drh | 960e8c6 | 2001-04-03 16:53:21 +0000 | [diff] [blame] | 30 | |
| 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 | */ |
| 40 | typedef unsigned int Pgno; |
| 41 | |
| 42 | /* |
| 43 | ** Each open file is managed by a separate instance of the "Pager" structure. |
| 44 | */ |
| 45 | typedef struct Pager Pager; |
| 46 | |
drh | 7e3b0a0 | 2001-04-28 16:52:40 +0000 | [diff] [blame^] | 47 | int sqlitepager_open(Pager **ppPager, const char *zFilename,int nPage,int nEx); |
drh | d9b0257 | 2001-04-15 00:37:09 +0000 | [diff] [blame] | 48 | int sqlitepager_close(Pager *pPager); |
| 49 | int sqlitepager_get(Pager *pPager, Pgno pgno, void **ppPage); |
drh | 7e3b0a0 | 2001-04-28 16:52:40 +0000 | [diff] [blame^] | 50 | void *sqlitepager_lookup(Pager *pPager, Pgno pgno); |
drh | d9b0257 | 2001-04-15 00:37:09 +0000 | [diff] [blame] | 51 | int sqlitepager_unref(void*); |
| 52 | Pgno sqlitepager_pagenumber(void*); |
| 53 | int sqlitepager_write(void*); |
| 54 | int sqlitepager_pagecount(Pager*); |
| 55 | int sqlitepager_commit(Pager*); |
| 56 | int sqlitepager_rollback(Pager*); |
drh | d9b0257 | 2001-04-15 00:37:09 +0000 | [diff] [blame] | 57 | int *sqlitepager_stats(Pager*); |