1d50deeebSshaneh /* 2d50deeebSshaneh ** 2011 March 18 3d50deeebSshaneh ** 4d50deeebSshaneh ** The author disclaims copyright to this source code. In place of 5d50deeebSshaneh ** a legal notice, here is a blessing: 6d50deeebSshaneh ** 7d50deeebSshaneh ** May you do good and not evil. 8d50deeebSshaneh ** May you find forgiveness for yourself and forgive others. 9d50deeebSshaneh ** May you share freely, never taking more than you give. 10d50deeebSshaneh ** 11d50deeebSshaneh ************************************************************************* 12d50deeebSshaneh ** 13d50deeebSshaneh ** This file contains a VFS "shim" - a layer that sits in between the 14d50deeebSshaneh ** pager and the real VFS. 15d50deeebSshaneh ** 16d50deeebSshaneh ** This particular shim enforces a multiplex system on DB files. 17d50deeebSshaneh ** This shim shards/partitions a single DB file into smaller 18d50deeebSshaneh ** "chunks" such that the total DB file size may exceed the maximum 19d50deeebSshaneh ** file size of the underlying file system. 20d50deeebSshaneh ** 21d50deeebSshaneh */ 22d50deeebSshaneh 23*43f58d6aSdrh #ifndef SQLITE_TEST_MULTIPLEX_H 24*43f58d6aSdrh #define SQLITE_TEST_MULTIPLEX_H 25d50deeebSshaneh 26d50deeebSshaneh /* 27d50deeebSshaneh ** CAPI: File-control Operations Supported by Multiplex VFS 28d50deeebSshaneh ** 29d50deeebSshaneh ** Values interpreted by the xFileControl method of a Multiplex VFS db file-handle. 30d50deeebSshaneh ** 31d50deeebSshaneh ** MULTIPLEX_CTRL_ENABLE: 32d50deeebSshaneh ** This file control is used to enable or disable the multiplex 33d50deeebSshaneh ** shim. 34d50deeebSshaneh ** 35d50deeebSshaneh ** MULTIPLEX_CTRL_SET_CHUNK_SIZE: 36d50deeebSshaneh ** This file control is used to set the maximum allowed chunk 3778c4de4cSshaneh ** size for a multiplex file set. The chunk size should be 3878c4de4cSshaneh ** a multiple of SQLITE_MAX_PAGE_SIZE, and will be rounded up 3978c4de4cSshaneh ** if not. 40d50deeebSshaneh ** 41d50deeebSshaneh ** MULTIPLEX_CTRL_SET_MAX_CHUNKS: 42d50deeebSshaneh ** This file control is used to set the maximum number of chunks 43d50deeebSshaneh ** allowed to be used for a mutliplex file set. 44d50deeebSshaneh */ 45d50deeebSshaneh #define MULTIPLEX_CTRL_ENABLE 214014 46d50deeebSshaneh #define MULTIPLEX_CTRL_SET_CHUNK_SIZE 214015 47d50deeebSshaneh #define MULTIPLEX_CTRL_SET_MAX_CHUNKS 214016 48d50deeebSshaneh 496e227bf3Sdrh #ifdef __cplusplus 506e227bf3Sdrh extern "C" { 516e227bf3Sdrh #endif 526e227bf3Sdrh 5378c4de4cSshaneh /* 5478c4de4cSshaneh ** CAPI: Initialize the multiplex VFS shim - sqlite3_multiplex_initialize() 5578c4de4cSshaneh ** 5678c4de4cSshaneh ** Use the VFS named zOrigVfsName as the VFS that does the actual work. 5778c4de4cSshaneh ** Use the default if zOrigVfsName==NULL. 5878c4de4cSshaneh ** 5978c4de4cSshaneh ** The multiplex VFS shim is named "multiplex". It will become the default 6078c4de4cSshaneh ** VFS if makeDefault is non-zero. 6178c4de4cSshaneh ** 6278c4de4cSshaneh ** An auto-extension is registered which will make the function 63d8ce22bbSshaneh ** multiplex_control() available to database connections. This 6478c4de4cSshaneh ** function gives access to the xFileControl interface of the 6578c4de4cSshaneh ** multiplex VFS shim. 6678c4de4cSshaneh ** 67d8ce22bbSshaneh ** SELECT multiplex_control(<op>,<val>); 6878c4de4cSshaneh ** 6978c4de4cSshaneh ** <op>=1 MULTIPLEX_CTRL_ENABLE 70d8ce22bbSshaneh ** <val>=0 disable 7178c4de4cSshaneh ** <val>=1 enable 7278c4de4cSshaneh ** 733801b65dSshaneh ** <op>=2 MULTIPLEX_CTRL_SET_CHUNK_SIZE 7478c4de4cSshaneh ** <val> int, chunk size 7578c4de4cSshaneh ** 763801b65dSshaneh ** <op>=3 MULTIPLEX_CTRL_SET_MAX_CHUNKS 7778c4de4cSshaneh ** <val> int, max chunks 7878c4de4cSshaneh ** 7978c4de4cSshaneh ** THIS ROUTINE IS NOT THREADSAFE. Call this routine exactly once 8078c4de4cSshaneh ** during start-up. 8178c4de4cSshaneh */ 8278c4de4cSshaneh extern int sqlite3_multiplex_initialize(const char *zOrigVfsName, int makeDefault); 8378c4de4cSshaneh 8478c4de4cSshaneh /* 8578c4de4cSshaneh ** CAPI: Shutdown the multiplex system - sqlite3_multiplex_shutdown() 8678c4de4cSshaneh ** 8778c4de4cSshaneh ** All SQLite database connections must be closed before calling this 8878c4de4cSshaneh ** routine. 8978c4de4cSshaneh ** 9078c4de4cSshaneh ** THIS ROUTINE IS NOT THREADSAFE. Call this routine exactly once while 9178c4de4cSshaneh ** shutting down in order to free all remaining multiplex groups. 9278c4de4cSshaneh */ 93a1a8298cSdrh extern int sqlite3_multiplex_shutdown(int eForce); 94d50deeebSshaneh 956e227bf3Sdrh #ifdef __cplusplus 966e227bf3Sdrh } /* End of the 'extern "C"' block */ 976e227bf3Sdrh #endif 986e227bf3Sdrh 99*43f58d6aSdrh #endif /* SQLITE_TEST_MULTIPLEX_H */ 100