monotone

monotone Mtn Source Tree

Root/sqlite/pager.h

1/*
2** 2001 September 15
3**
4** The author disclaims copyright to this source code. In place of
5** a legal notice, here is a blessing:
6**
7** 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.
10**
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**
16** @(#) $Id: pager.h,v 1.61 2007/05/08 21:45:28 drh Exp $
17*/
18
19#ifndef _PAGER_H_
20#define _PAGER_H_
21
22/*
23** The type used to represent a page number. The first page in a file
24** is called page 1. 0 is used to represent "not a page".
25*/
26typedef unsigned int Pgno;
27
28/*
29** Each open file is managed by a separate instance of the "Pager" structure.
30*/
31typedef struct Pager Pager;
32
33/*
34** Handle type for pages.
35*/
36typedef struct PgHdr DbPage;
37
38/*
39** Allowed values for the flags parameter to sqlite3PagerOpen().
40**
41** NOTE: This values must match the corresponding BTREE_ values in btree.h.
42*/
43#define PAGER_OMIT_JOURNAL 0x0001 /* Do not use a rollback journal */
44#define PAGER_NO_READLOCK 0x0002 /* Omit readlocks on readonly files */
45
46/*
47** Valid values for the second argument to sqlite3PagerLockingMode().
48*/
49#define PAGER_LOCKINGMODE_QUERY -1
50#define PAGER_LOCKINGMODE_NORMAL 0
51#define PAGER_LOCKINGMODE_EXCLUSIVE 1
52
53/*
54** See source code comments for a detailed description of the following
55** routines:
56*/
57int sqlite3PagerOpen(Pager **ppPager, const char *zFilename,
58 int nExtra, int flags);
59void sqlite3PagerSetBusyhandler(Pager*, BusyHandler *pBusyHandler);
60void sqlite3PagerSetDestructor(Pager*, void(*)(DbPage*,int));
61void sqlite3PagerSetReiniter(Pager*, void(*)(DbPage*,int));
62int sqlite3PagerSetPagesize(Pager*, int);
63int sqlite3PagerMaxPageCount(Pager*, int);
64int sqlite3PagerReadFileheader(Pager*, int, unsigned char*);
65void sqlite3PagerSetCachesize(Pager*, int);
66int sqlite3PagerClose(Pager *pPager);
67int sqlite3PagerAcquire(Pager *pPager, Pgno pgno, DbPage **ppPage, int clrFlag);
68#define sqlite3PagerGet(A,B,C) sqlite3PagerAcquire(A,B,C,0)
69DbPage *sqlite3PagerLookup(Pager *pPager, Pgno pgno);
70int sqlite3PagerRef(DbPage*);
71int sqlite3PagerUnref(DbPage*);
72int sqlite3PagerWrite(DbPage*);
73int sqlite3PagerOverwrite(Pager *pPager, Pgno pgno, void*);
74int sqlite3PagerPagecount(Pager*);
75int sqlite3PagerTruncate(Pager*,Pgno);
76int sqlite3PagerBegin(DbPage*, int exFlag);
77int sqlite3PagerCommitPhaseOne(Pager*,const char *zMaster, Pgno);
78int sqlite3PagerCommitPhaseTwo(Pager*);
79int sqlite3PagerRollback(Pager*);
80int sqlite3PagerIsreadonly(Pager*);
81int sqlite3PagerStmtBegin(Pager*);
82int sqlite3PagerStmtCommit(Pager*);
83int sqlite3PagerStmtRollback(Pager*);
84void sqlite3PagerDontRollback(DbPage*);
85void sqlite3PagerDontWrite(DbPage*);
86int sqlite3PagerRefcount(Pager*);
87void sqlite3PagerSetSafetyLevel(Pager*,int,int);
88const char *sqlite3PagerFilename(Pager*);
89const char *sqlite3PagerDirname(Pager*);
90const char *sqlite3PagerJournalname(Pager*);
91int sqlite3PagerNosync(Pager*);
92int sqlite3PagerMovepage(Pager*,DbPage*,Pgno);
93void *sqlite3PagerGetData(DbPage *);
94void *sqlite3PagerGetExtra(DbPage *);
95int sqlite3PagerLockingMode(Pager *, int);
96
97#if defined(SQLITE_ENABLE_MEMORY_MANAGEMENT) && !defined(SQLITE_OMIT_DISKIO)
98 int sqlite3PagerReleaseMemory(int);
99#endif
100
101#ifdef SQLITE_HAS_CODEC
102 void sqlite3PagerSetCodec(Pager*,void*(*)(void*,void*,Pgno,int),void*);
103#endif
104
105#if !defined(NDEBUG) || defined(SQLITE_TEST)
106 Pgno sqlite3PagerPagenumber(DbPage*);
107 int sqlite3PagerIswriteable(DbPage*);
108#endif
109
110#if defined(SQLITE_DEBUG) || defined(SQLITE_TEST)
111 int sqlite3PagerLockstate(Pager*);
112#endif
113
114#ifdef SQLITE_TEST
115 int *sqlite3PagerStats(Pager*);
116 void sqlite3PagerRefdump(Pager*);
117 int pager3_refinfo_enable;
118#endif
119
120#ifdef SQLITE_TEST
121void disable_simulated_io_errors(void);
122void enable_simulated_io_errors(void);
123#else
124# define disable_simulated_io_errors()
125# define enable_simulated_io_errors()
126#endif
127
128#endif /* _PAGER_H_ */

Archive Download this file

Branches

Tags

Quick Links:     www.monotone.ca    -     Downloads    -     Documentation    -     Wiki    -     Code Forge    -     Build Status