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 | 092d035 | 2001-09-15 13:15:12 +0000 | [diff] [blame] | 28 | ** @(#) $Id: pager.h,v 1.10 2001/09/15 13:15:13 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 | /* |
drh | 092d035 | 2001-09-15 13:15:12 +0000 | [diff] [blame] | 37 | ** 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 | /* |
drh | 960e8c6 | 2001-04-03 16:53:21 +0000 | [diff] [blame] | 43 | ** 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 | */ |
| 46 | typedef unsigned int Pgno; |
| 47 | |
| 48 | /* |
| 49 | ** Each open file is managed by a separate instance of the "Pager" structure. |
| 50 | */ |
| 51 | typedef struct Pager Pager; |
| 52 | |
drh | 72f8286 | 2001-05-24 21:06:34 +0000 | [diff] [blame] | 53 | int sqlitepager_open(Pager **ppPager,const char *zFilename,int nPage,int nEx); |
drh | 8c42ca9 | 2001-06-22 19:15:00 +0000 | [diff] [blame] | 54 | void sqlitepager_set_destructor(Pager*, void(*)(void*)); |
drh | f57b14a | 2001-09-14 18:54:08 +0000 | [diff] [blame] | 55 | void sqlitepager_set_cachesize(Pager*, int); |
drh | d9b0257 | 2001-04-15 00:37:09 +0000 | [diff] [blame] | 56 | int sqlitepager_close(Pager *pPager); |
| 57 | int sqlitepager_get(Pager *pPager, Pgno pgno, void **ppPage); |
drh | 7e3b0a0 | 2001-04-28 16:52:40 +0000 | [diff] [blame] | 58 | void *sqlitepager_lookup(Pager *pPager, Pgno pgno); |
drh | 8c42ca9 | 2001-06-22 19:15:00 +0000 | [diff] [blame] | 59 | int sqlitepager_ref(void*); |
drh | d9b0257 | 2001-04-15 00:37:09 +0000 | [diff] [blame] | 60 | int sqlitepager_unref(void*); |
| 61 | Pgno sqlitepager_pagenumber(void*); |
| 62 | int sqlitepager_write(void*); |
drh | 6019e16 | 2001-07-02 17:51:45 +0000 | [diff] [blame] | 63 | int sqlitepager_iswriteable(void*); |
drh | d9b0257 | 2001-04-15 00:37:09 +0000 | [diff] [blame] | 64 | int sqlitepager_pagecount(Pager*); |
| 65 | int sqlitepager_commit(Pager*); |
| 66 | int sqlitepager_rollback(Pager*); |
drh | 5e00f6c | 2001-09-13 13:46:56 +0000 | [diff] [blame] | 67 | int sqlitepager_isreadonly(Pager*); |
drh | d9b0257 | 2001-04-15 00:37:09 +0000 | [diff] [blame] | 68 | int *sqlitepager_stats(Pager*); |
drh | dd79342 | 2001-06-28 01:54:48 +0000 | [diff] [blame] | 69 | |
| 70 | #ifdef SQLITE_TEST |
| 71 | void sqlitepager_refdump(Pager*); |
| 72 | int pager_refinfo_enable; |
| 73 | #endif |