Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Add a version number to the sqlite3_pcache_methods2 object. Other PCACHE2 documentation improvements. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | experimental-pcache |
Files: | files | file ages | folders |
SHA1: |
9f839ac05a9f3cfe587d2ccdccd50dac |
User & Date: | drh 2011-11-13 21:44:03.995 |
Context
2011-11-16
| ||
18:08 | Merge the PCACHE2 changes into trunk. (check-in: 457513f21f user: drh tags: trunk) | |
2011-11-14
| ||
01:55 | Begin making experimental changes to use mmap() for reading content from a database. The code compiles, but crashes on the test suite. (check-in: 09be42d5fa user: drh tags: mmap-experimental) | |
2011-11-13
| ||
21:44 | Add a version number to the sqlite3_pcache_methods2 object. Other PCACHE2 documentation improvements. (Closed-Leaf check-in: 9f839ac05a user: drh tags: experimental-pcache) | |
2011-11-12
| ||
23:10 | Attempt to modify btree.c so that it assumes that calls to sqlite3PagerWrite() will reallocate the page buffer. As there is not good way to test this assumption yet, probably a few spots were missed. (check-in: ceee03c79a user: drh tags: experimental-pcache) | |
Changes
Changes to src/pcache1.c.
︙ | ︙ | |||
920 921 922 923 924 925 926 927 928 929 930 931 932 933 | /* ** This function is called during initialization (sqlite3_initialize()) to ** install the default pluggable cache module, assuming the user has not ** already provided an alternative. */ void sqlite3PCacheSetDefault(void){ static const sqlite3_pcache_methods2 defaultMethods = { 0, /* pArg */ pcache1Init, /* xInit */ pcache1Shutdown, /* xShutdown */ pcache1Create, /* xCreate */ pcache1Cachesize, /* xCachesize */ pcache1Pagecount, /* xPagecount */ pcache1Fetch, /* xFetch */ | > | 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 | /* ** This function is called during initialization (sqlite3_initialize()) to ** install the default pluggable cache module, assuming the user has not ** already provided an alternative. */ void sqlite3PCacheSetDefault(void){ static const sqlite3_pcache_methods2 defaultMethods = { 1, /* iVersion */ 0, /* pArg */ pcache1Init, /* xInit */ pcache1Shutdown, /* xShutdown */ pcache1Create, /* xCreate */ pcache1Cachesize, /* xCachesize */ pcache1Pagecount, /* xPagecount */ pcache1Fetch, /* xFetch */ |
︙ | ︙ |
Changes to src/sqlite.h.in.
︙ | ︙ | |||
5930 5931 5932 5933 5934 5935 5936 | ** ** The sqlite3_pcache type is opaque. It is implemented by ** the pluggable module. The SQLite core has no knowledge of ** its size or internal structure and never deals with the ** sqlite3_pcache object except by holding and passing pointers ** to the object. ** | | > > > > > > > > > > > > > > > > | 5930 5931 5932 5933 5934 5935 5936 5937 5938 5939 5940 5941 5942 5943 5944 5945 5946 5947 5948 5949 5950 5951 5952 5953 5954 5955 5956 5957 5958 5959 5960 5961 5962 | ** ** The sqlite3_pcache type is opaque. It is implemented by ** the pluggable module. The SQLite core has no knowledge of ** its size or internal structure and never deals with the ** sqlite3_pcache object except by holding and passing pointers ** to the object. ** ** See [sqlite3_pcache_methods2] for additional information. */ typedef struct sqlite3_pcache sqlite3_pcache; /* ** CAPI3REF: Custom Page Cache Object ** ** The sqlite3_pcache_page object represents a single page in the ** page cache. The page cache will allocate instances of this ** object. Various methods of the page cache use pointers to instances ** of this object as parameters or as their return value. ** ** See [sqlite3_pcache_methods2] for additional information. */ typedef struct sqlite3_pcache_page sqlite3_pcache_page; struct sqlite3_pcache_page { void *pBuf; /* The content of the page */ void *pExtra; /* Extra information associated with the page */ }; /* ** CAPI3REF: Application Defined Page Cache. ** KEYWORDS: {page cache} ** ** ^(The [sqlite3_config]([SQLITE_CONFIG_PCACHE2], ...) interface can ** register an alternative page cache implementation by passing in an |
︙ | ︙ | |||
6088 6089 6090 6091 6092 6093 6094 | ** ^The xDestroy() method is used to delete a cache allocated by xCreate(). ** All resources associated with the specified cache should be freed. ^After ** calling the xDestroy() method, SQLite considers the [sqlite3_pcache*] ** handle invalid, and will not use it with any other sqlite3_pcache_methods ** functions. */ typedef struct sqlite3_pcache_methods2 sqlite3_pcache_methods2; | < < < < < > | 6104 6105 6106 6107 6108 6109 6110 6111 6112 6113 6114 6115 6116 6117 6118 6119 | ** ^The xDestroy() method is used to delete a cache allocated by xCreate(). ** All resources associated with the specified cache should be freed. ^After ** calling the xDestroy() method, SQLite considers the [sqlite3_pcache*] ** handle invalid, and will not use it with any other sqlite3_pcache_methods ** functions. */ typedef struct sqlite3_pcache_methods2 sqlite3_pcache_methods2; struct sqlite3_pcache_methods2 { int iVersion; void *pArg; int (*xInit)(void*); void (*xShutdown)(void*); sqlite3_pcache *(*xCreate)(int szPage, int szExtra, int bPurgeable); void (*xCachesize)(sqlite3_pcache*, int nCachesize); int (*xPagecount)(sqlite3_pcache*); sqlite3_pcache_page *(*xFetch)(sqlite3_pcache*, unsigned key, int createFlag); |
︙ | ︙ |
Changes to src/test_init.c.
︙ | ︙ | |||
156 157 158 159 160 161 162 | static void installInitWrappers(void){ sqlite3_mutex_methods mutexmethods = { wrMutexInit, wrMutexEnd, wrMutexAlloc, wrMutexFree, wrMutexEnter, wrMutexTry, wrMutexLeave, wrMutexHeld, wrMutexNotheld }; sqlite3_pcache_methods2 pcachemethods = { | | | 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 | static void installInitWrappers(void){ sqlite3_mutex_methods mutexmethods = { wrMutexInit, wrMutexEnd, wrMutexAlloc, wrMutexFree, wrMutexEnter, wrMutexTry, wrMutexLeave, wrMutexHeld, wrMutexNotheld }; sqlite3_pcache_methods2 pcachemethods = { 1, 0, wrPCacheInit, wrPCacheShutdown, wrPCacheCreate, wrPCacheCachesize, wrPCachePagecount, wrPCacheFetch, wrPCacheUnpin, wrPCacheRekey, wrPCacheTruncate, wrPCacheDestroy }; sqlite3_mem_methods memmethods = { wrMemMalloc, wrMemFree, wrMemRealloc, |
︙ | ︙ |
Changes to src/test_pcache.c.
︙ | ︙ | |||
428 429 430 431 432 433 434 435 436 437 438 439 440 441 | void installTestPCache( int installFlag, /* True to install. False to uninstall. */ unsigned discardChance, /* 0-100. Chance to discard on unpin */ unsigned prngSeed, /* Seed for the PRNG */ unsigned highStress /* Call xStress agressively */ ){ static const sqlite3_pcache_methods2 testPcache = { (void*)&testpcacheGlobal, testpcacheInit, testpcacheShutdown, testpcacheCreate, testpcacheCachesize, testpcachePagecount, testpcacheFetch, | > | 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 | void installTestPCache( int installFlag, /* True to install. False to uninstall. */ unsigned discardChance, /* 0-100. Chance to discard on unpin */ unsigned prngSeed, /* Seed for the PRNG */ unsigned highStress /* Call xStress agressively */ ){ static const sqlite3_pcache_methods2 testPcache = { 1, (void*)&testpcacheGlobal, testpcacheInit, testpcacheShutdown, testpcacheCreate, testpcacheCachesize, testpcachePagecount, testpcacheFetch, |
︙ | ︙ |