Index: third_party/sqlite/src/src/pcache.h |
diff --git a/third_party/sqlite/src/src/pcache.h b/third_party/sqlite/src/src/pcache.h |
index 33735d2cbb2dc159ca988e91f90b8658f91e5394..dd9bfc7451c308d3e2ced6f0aeb11b8633d196be 100644 |
--- a/third_party/sqlite/src/src/pcache.h |
+++ b/third_party/sqlite/src/src/pcache.h |
@@ -23,11 +23,12 @@ typedef struct PCache PCache; |
** structure. |
*/ |
struct PgHdr { |
- void *pData; /* Content of this page */ |
+ sqlite3_pcache_page *pPage; /* Pcache object page handle */ |
+ void *pData; /* Page data */ |
void *pExtra; /* Extra content */ |
PgHdr *pDirty; /* Transient list of dirty pages */ |
- Pgno pgno; /* Page number for this page */ |
Pager *pPager; /* The pager this page is part of */ |
+ Pgno pgno; /* Page number for this page */ |
#ifdef SQLITE_CHECK_PAGES |
u32 pageHash; /* Hash of page content */ |
#endif |
@@ -52,6 +53,8 @@ struct PgHdr { |
#define PGHDR_REUSE_UNLIKELY 0x010 /* A hint that reuse is unlikely */ |
#define PGHDR_DONT_WRITE 0x020 /* Do not write content to disk */ |
+#define PGHDR_MMAP 0x040 /* This is an mmap page object */ |
+ |
/* Initialize and shutdown the page cache subsystem */ |
int sqlite3PcacheInitialize(void); |
void sqlite3PcacheShutdown(void); |
@@ -65,7 +68,7 @@ void sqlite3PCacheBufferSetup(void *, int sz, int n); |
** Under memory stress, invoke xStress to try to make pages clean. |
** Only clean and unpinned pages can be reclaimed. |
*/ |
-void sqlite3PcacheOpen( |
+int sqlite3PcacheOpen( |
int szPage, /* Size of every page */ |
int szExtra, /* Extra space associated with each page */ |
int bPurgeable, /* True if pages are on backing store */ |
@@ -75,7 +78,7 @@ void sqlite3PcacheOpen( |
); |
/* Modify the page-size after the cache has been created. */ |
-void sqlite3PcacheSetPageSize(PCache *, int); |
+int sqlite3PcacheSetPageSize(PCache *, int); |
/* Return the size in bytes of a PCache object. Used to preallocate |
** storage space. |
@@ -85,7 +88,9 @@ int sqlite3PcacheSize(void); |
/* One release per successful fetch. Page is pinned until released. |
** Reference counted. |
*/ |
-int sqlite3PcacheFetch(PCache*, Pgno, int createFlag, PgHdr**); |
+sqlite3_pcache_page *sqlite3PcacheFetch(PCache*, Pgno, int createFlag); |
+int sqlite3PcacheFetchStress(PCache*, Pgno, sqlite3_pcache_page**); |
+PgHdr *sqlite3PcacheFetchFinish(PCache*, Pgno, sqlite3_pcache_page *pPage); |
void sqlite3PcacheRelease(PgHdr*); |
void sqlite3PcacheDrop(PgHdr*); /* Remove page from cache */ |
@@ -141,6 +146,9 @@ void sqlite3PcacheSetCachesize(PCache *, int); |
int sqlite3PcacheGetCachesize(PCache *); |
#endif |
+/* Free up as much memory as possible from the page cache */ |
+void sqlite3PcacheShrink(PCache*); |
+ |
#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT |
/* Try to return memory used by the pcache module to the main memory heap */ |
int sqlite3PcacheReleaseMemory(int); |