test_multiplex.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /*
  2. ** 2011 March 18
  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. **
  13. ** This file contains a VFS "shim" - a layer that sits in between the
  14. ** pager and the real VFS.
  15. **
  16. ** This particular shim enforces a multiplex system on DB files.
  17. ** This shim shards/partitions a single DB file into smaller
  18. ** "chunks" such that the total DB file size may exceed the maximum
  19. ** file size of the underlying file system.
  20. **
  21. */
  22. #ifndef SQLITE_TEST_MULTIPLEX_H
  23. #define SQLITE_TEST_MULTIPLEX_H
  24. /*
  25. ** CAPI: File-control Operations Supported by Multiplex VFS
  26. **
  27. ** Values interpreted by the xFileControl method of a Multiplex VFS db file-handle.
  28. **
  29. ** MULTIPLEX_CTRL_ENABLE:
  30. ** This file control is used to enable or disable the multiplex
  31. ** shim.
  32. **
  33. ** MULTIPLEX_CTRL_SET_CHUNK_SIZE:
  34. ** This file control is used to set the maximum allowed chunk
  35. ** size for a multiplex file set. The chunk size should be
  36. ** a multiple of SQLITE_MAX_PAGE_SIZE, and will be rounded up
  37. ** if not.
  38. **
  39. ** MULTIPLEX_CTRL_SET_MAX_CHUNKS:
  40. ** This file control is used to set the maximum number of chunks
  41. ** allowed to be used for a mutliplex file set.
  42. */
  43. #define MULTIPLEX_CTRL_ENABLE 214014
  44. #define MULTIPLEX_CTRL_SET_CHUNK_SIZE 214015
  45. #define MULTIPLEX_CTRL_SET_MAX_CHUNKS 214016
  46. #ifdef __cplusplus
  47. extern "C" {
  48. #endif
  49. /*
  50. ** CAPI: Initialize the multiplex VFS shim - sqlite3_multiplex_initialize()
  51. **
  52. ** Use the VFS named zOrigVfsName as the VFS that does the actual work.
  53. ** Use the default if zOrigVfsName==NULL.
  54. **
  55. ** The multiplex VFS shim is named "multiplex". It will become the default
  56. ** VFS if makeDefault is non-zero.
  57. **
  58. ** An auto-extension is registered which will make the function
  59. ** multiplex_control() available to database connections. This
  60. ** function gives access to the xFileControl interface of the
  61. ** multiplex VFS shim.
  62. **
  63. ** SELECT multiplex_control(<op>,<val>);
  64. **
  65. ** <op>=1 MULTIPLEX_CTRL_ENABLE
  66. ** <val>=0 disable
  67. ** <val>=1 enable
  68. **
  69. ** <op>=2 MULTIPLEX_CTRL_SET_CHUNK_SIZE
  70. ** <val> int, chunk size
  71. **
  72. ** <op>=3 MULTIPLEX_CTRL_SET_MAX_CHUNKS
  73. ** <val> int, max chunks
  74. **
  75. ** THIS ROUTINE IS NOT THREADSAFE. Call this routine exactly once
  76. ** during start-up.
  77. */
  78. extern int sqlite3_multiplex_initialize(const char *zOrigVfsName, int makeDefault);
  79. /*
  80. ** CAPI: Shutdown the multiplex system - sqlite3_multiplex_shutdown()
  81. **
  82. ** All SQLite database connections must be closed before calling this
  83. ** routine.
  84. **
  85. ** THIS ROUTINE IS NOT THREADSAFE. Call this routine exactly once while
  86. ** shutting down in order to free all remaining multiplex groups.
  87. */
  88. extern int sqlite3_multiplex_shutdown(int eForce);
  89. #ifdef __cplusplus
  90. } /* End of the 'extern "C"' block */
  91. #endif
  92. #endif /* SQLITE_TEST_MULTIPLEX_H */