提交 e3771119 编写于 作者: H Hongze Cheng

start to integrate pager of sqlite

上级 44b30074
此差异已折叠。
......@@ -42,15 +42,15 @@ typedef struct Pager Pager;
*/
typedef struct PgHdr DbPage;
/*
** Page number PAGER_MJ_PGNO is never used in an SQLite database (it is
** reserved for working around a windows/posix incompatibility). It is
** used in the journal to signify that the remainder of the journal file
** is devoted to storing a super-journal name - there are no more pages to
** roll back. See comments for function writeSuperJournal() in pager.c
** for details.
*/
#define PAGER_MJ_PGNO(x) ((Pgno)((PENDING_BYTE/((x)->pageSize))+1))
// /*
// ** Page number PAGER_MJ_PGNO is never used in an SQLite database (it is
// ** reserved for working around a windows/posix incompatibility). It is
// ** used in the journal to signify that the remainder of the journal file
// ** is devoted to storing a super-journal name - there are no more pages to
// ** roll back. See comments for function writeSuperJournal() in pager.c
// ** for details.
// */
// #define PAGER_MJ_PGNO(x) ((Pgno)((PENDING_BYTE/((x)->pageSize))+1))
/*
** Allowed values for the flags parameter to sqlite3PagerOpen().
......@@ -123,120 +123,120 @@ int sqlite3PagerOpen(
void(*)(DbPage*)
);
int sqlite3PagerClose(Pager *pPager, sqlite3*);
int sqlite3PagerReadFileheader(Pager*, int, unsigned char*);
/* Functions used to configure a Pager object. */
void sqlite3PagerSetBusyHandler(Pager*, int(*)(void *), void *);
int sqlite3PagerSetPagesize(Pager*, u32*, int);
Pgno sqlite3PagerMaxPageCount(Pager*, Pgno);
void sqlite3PagerSetCachesize(Pager*, int);
int sqlite3PagerSetSpillsize(Pager*, int);
void sqlite3PagerSetMmapLimit(Pager *, sqlite3_int64);
void sqlite3PagerShrink(Pager*);
void sqlite3PagerSetFlags(Pager*,unsigned);
int sqlite3PagerLockingMode(Pager *, int);
int sqlite3PagerSetJournalMode(Pager *, int);
int sqlite3PagerGetJournalMode(Pager*);
int sqlite3PagerOkToChangeJournalMode(Pager*);
i64 sqlite3PagerJournalSizeLimit(Pager *, i64);
sqlite3_backup **sqlite3PagerBackupPtr(Pager*);
int sqlite3PagerFlush(Pager*);
/* Functions used to obtain and release page references. */
int sqlite3PagerGet(Pager *pPager, Pgno pgno, DbPage **ppPage, int clrFlag);
DbPage *sqlite3PagerLookup(Pager *pPager, Pgno pgno);
void sqlite3PagerRef(DbPage*);
void sqlite3PagerUnref(DbPage*);
void sqlite3PagerUnrefNotNull(DbPage*);
void sqlite3PagerUnrefPageOne(DbPage*);
/* Operations on page references. */
int sqlite3PagerWrite(DbPage*);
void sqlite3PagerDontWrite(DbPage*);
int sqlite3PagerMovepage(Pager*,DbPage*,Pgno,int);
int sqlite3PagerPageRefcount(DbPage*);
void *sqlite3PagerGetData(DbPage *);
void *sqlite3PagerGetExtra(DbPage *);
/* Functions used to manage pager transactions and savepoints. */
void sqlite3PagerPagecount(Pager*, int*);
int sqlite3PagerBegin(Pager*, int exFlag, int);
int sqlite3PagerCommitPhaseOne(Pager*,const char *zSuper, int);
int sqlite3PagerExclusiveLock(Pager*);
int sqlite3PagerSync(Pager *pPager, const char *zSuper);
int sqlite3PagerCommitPhaseTwo(Pager*);
int sqlite3PagerRollback(Pager*);
int sqlite3PagerOpenSavepoint(Pager *pPager, int n);
int sqlite3PagerSavepoint(Pager *pPager, int op, int iSavepoint);
int sqlite3PagerSharedLock(Pager *pPager);
#ifndef SQLITE_OMIT_WAL
int sqlite3PagerCheckpoint(Pager *pPager, sqlite3*, int, int*, int*);
int sqlite3PagerWalSupported(Pager *pPager);
int sqlite3PagerWalCallback(Pager *pPager);
int sqlite3PagerOpenWal(Pager *pPager, int *pisOpen);
int sqlite3PagerCloseWal(Pager *pPager, sqlite3*);
# ifdef SQLITE_ENABLE_SNAPSHOT
int sqlite3PagerSnapshotGet(Pager*, sqlite3_snapshot **ppSnapshot);
int sqlite3PagerSnapshotOpen(Pager*, sqlite3_snapshot *pSnapshot);
int sqlite3PagerSnapshotRecover(Pager *pPager);
int sqlite3PagerSnapshotCheck(Pager *pPager, sqlite3_snapshot *pSnapshot);
void sqlite3PagerSnapshotUnlock(Pager *pPager);
# endif
#endif
#if !defined(SQLITE_OMIT_WAL) && defined(SQLITE_ENABLE_SETLK_TIMEOUT)
int sqlite3PagerWalWriteLock(Pager*, int);
void sqlite3PagerWalDb(Pager*, sqlite3*);
#else
# define sqlite3PagerWalWriteLock(y,z) SQLITE_OK
# define sqlite3PagerWalDb(x,y)
#endif
#ifdef SQLITE_DIRECT_OVERFLOW_READ
int sqlite3PagerDirectReadOk(Pager *pPager, Pgno pgno);
#endif
#ifdef SQLITE_ENABLE_ZIPVFS
int sqlite3PagerWalFramesize(Pager *pPager);
#endif
/* Functions used to query pager state and configuration. */
u8 sqlite3PagerIsreadonly(Pager*);
u32 sqlite3PagerDataVersion(Pager*);
#ifdef SQLITE_DEBUG
int sqlite3PagerRefcount(Pager*);
#endif
int sqlite3PagerMemUsed(Pager*);
const char *sqlite3PagerFilename(const Pager*, int);
sqlite3_vfs *sqlite3PagerVfs(Pager*);
sqlite3_file *sqlite3PagerFile(Pager*);
sqlite3_file *sqlite3PagerJrnlFile(Pager*);
const char *sqlite3PagerJournalname(Pager*);
void *sqlite3PagerTempSpace(Pager*);
int sqlite3PagerIsMemdb(Pager*);
void sqlite3PagerCacheStat(Pager *, int, int, int *);
void sqlite3PagerClearCache(Pager*);
int sqlite3SectorSize(sqlite3_file *);
/* Functions used to truncate the database file. */
void sqlite3PagerTruncateImage(Pager*,Pgno);
void sqlite3PagerRekey(DbPage*, Pgno, u16);
/* Functions to support testing and debugging. */
#if !defined(NDEBUG) || defined(SQLITE_TEST)
Pgno sqlite3PagerPagenumber(DbPage*);
int sqlite3PagerIswriteable(DbPage*);
#endif
#ifdef SQLITE_TEST
int *sqlite3PagerStats(Pager*);
void sqlite3PagerRefdump(Pager*);
void disable_simulated_io_errors(void);
void enable_simulated_io_errors(void);
#else
# define disable_simulated_io_errors()
# define enable_simulated_io_errors()
#endif
// int sqlite3PagerReadFileheader(Pager*, int, unsigned char*);
// /* Functions used to configure a Pager object. */
// void sqlite3PagerSetBusyHandler(Pager*, int(*)(void *), void *);
// int sqlite3PagerSetPagesize(Pager*, u32*, int);
// Pgno sqlite3PagerMaxPageCount(Pager*, Pgno);
// void sqlite3PagerSetCachesize(Pager*, int);
// int sqlite3PagerSetSpillsize(Pager*, int);
// void sqlite3PagerSetMmapLimit(Pager *, sqlite3_int64);
// void sqlite3PagerShrink(Pager*);
// void sqlite3PagerSetFlags(Pager*,unsigned);
// int sqlite3PagerLockingMode(Pager *, int);
// int sqlite3PagerSetJournalMode(Pager *, int);
// int sqlite3PagerGetJournalMode(Pager*);
// int sqlite3PagerOkToChangeJournalMode(Pager*);
// i64 sqlite3PagerJournalSizeLimit(Pager *, i64);
// sqlite3_backup **sqlite3PagerBackupPtr(Pager*);
// int sqlite3PagerFlush(Pager*);
// /* Functions used to obtain and release page references. */
// int sqlite3PagerGet(Pager *pPager, Pgno pgno, DbPage **ppPage, int clrFlag);
// DbPage *sqlite3PagerLookup(Pager *pPager, Pgno pgno);
// void sqlite3PagerRef(DbPage*);
// void sqlite3PagerUnref(DbPage*);
// void sqlite3PagerUnrefNotNull(DbPage*);
// void sqlite3PagerUnrefPageOne(DbPage*);
// /* Operations on page references. */
// int sqlite3PagerWrite(DbPage*);
// void sqlite3PagerDontWrite(DbPage*);
// int sqlite3PagerMovepage(Pager*,DbPage*,Pgno,int);
// int sqlite3PagerPageRefcount(DbPage*);
// void *sqlite3PagerGetData(DbPage *);
// void *sqlite3PagerGetExtra(DbPage *);
// /* Functions used to manage pager transactions and savepoints. */
// void sqlite3PagerPagecount(Pager*, int*);
// int sqlite3PagerBegin(Pager*, int exFlag, int);
// int sqlite3PagerCommitPhaseOne(Pager*,const char *zSuper, int);
// int sqlite3PagerExclusiveLock(Pager*);
// int sqlite3PagerSync(Pager *pPager, const char *zSuper);
// int sqlite3PagerCommitPhaseTwo(Pager*);
// int sqlite3PagerRollback(Pager*);
// int sqlite3PagerOpenSavepoint(Pager *pPager, int n);
// int sqlite3PagerSavepoint(Pager *pPager, int op, int iSavepoint);
// int sqlite3PagerSharedLock(Pager *pPager);
// #ifndef SQLITE_OMIT_WAL
// int sqlite3PagerCheckpoint(Pager *pPager, sqlite3*, int, int*, int*);
// int sqlite3PagerWalSupported(Pager *pPager);
// int sqlite3PagerWalCallback(Pager *pPager);
// int sqlite3PagerOpenWal(Pager *pPager, int *pisOpen);
// int sqlite3PagerCloseWal(Pager *pPager, sqlite3*);
// # ifdef SQLITE_ENABLE_SNAPSHOT
// int sqlite3PagerSnapshotGet(Pager*, sqlite3_snapshot **ppSnapshot);
// int sqlite3PagerSnapshotOpen(Pager*, sqlite3_snapshot *pSnapshot);
// int sqlite3PagerSnapshotRecover(Pager *pPager);
// int sqlite3PagerSnapshotCheck(Pager *pPager, sqlite3_snapshot *pSnapshot);
// void sqlite3PagerSnapshotUnlock(Pager *pPager);
// # endif
// #endif
// #if !defined(SQLITE_OMIT_WAL) && defined(SQLITE_ENABLE_SETLK_TIMEOUT)
// int sqlite3PagerWalWriteLock(Pager*, int);
// void sqlite3PagerWalDb(Pager*, sqlite3*);
// #else
// # define sqlite3PagerWalWriteLock(y,z) SQLITE_OK
// # define sqlite3PagerWalDb(x,y)
// #endif
// #ifdef SQLITE_DIRECT_OVERFLOW_READ
// int sqlite3PagerDirectReadOk(Pager *pPager, Pgno pgno);
// #endif
// #ifdef SQLITE_ENABLE_ZIPVFS
// int sqlite3PagerWalFramesize(Pager *pPager);
// #endif
// /* Functions used to query pager state and configuration. */
// u8 sqlite3PagerIsreadonly(Pager*);
// u32 sqlite3PagerDataVersion(Pager*);
// #ifdef SQLITE_DEBUG
// int sqlite3PagerRefcount(Pager*);
// #endif
// int sqlite3PagerMemUsed(Pager*);
// const char *sqlite3PagerFilename(const Pager*, int);
// sqlite3_vfs *sqlite3PagerVfs(Pager*);
// sqlite3_file *sqlite3PagerFile(Pager*);
// sqlite3_file *sqlite3PagerJrnlFile(Pager*);
// const char *sqlite3PagerJournalname(Pager*);
// void *sqlite3PagerTempSpace(Pager*);
// int sqlite3PagerIsMemdb(Pager*);
// void sqlite3PagerCacheStat(Pager *, int, int, int *);
// void sqlite3PagerClearCache(Pager*);
// int sqlite3SectorSize(sqlite3_file *);
// /* Functions used to truncate the database file. */
// void sqlite3PagerTruncateImage(Pager*,Pgno);
// void sqlite3PagerRekey(DbPage*, Pgno, u16);
// /* Functions to support testing and debugging. */
// #if !defined(NDEBUG) || defined(SQLITE_TEST)
// Pgno sqlite3PagerPagenumber(DbPage*);
// int sqlite3PagerIswriteable(DbPage*);
// #endif
// #ifdef SQLITE_TEST
// int *sqlite3PagerStats(Pager*);
// void sqlite3PagerRefdump(Pager*);
// void disable_simulated_io_errors(void);
// void enable_simulated_io_errors(void);
// #else
// # define disable_simulated_io_errors()
// # define enable_simulated_io_errors()
// #endif
#endif /* SQLITE_PAGER_H */
......@@ -43,6 +43,9 @@ typedef struct sqlite3_pcache_page {
#define ROUND8(x) (((x) + 7) & ~7)
typedef struct sqlite3_vfs sqlite3_vfs;
typedef struct sqlite3 sqlite3;
#include "pager.h"
#include "pcache.h"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册