harperdb 3.2.0 → 3.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (578) hide show
  1. package/README.md +20 -11
  2. package/bin/BinObjects.jsc +0 -0
  3. package/bin/harperdb.jsc +0 -0
  4. package/bin/install.jsc +0 -0
  5. package/bin/register.jsc +0 -0
  6. package/bin/run.jsc +0 -0
  7. package/bin/stop.jsc +0 -0
  8. package/bin/upgrade.jsc +0 -0
  9. package/bin/utility.jsc +0 -0
  10. package/bin/version.jsc +0 -0
  11. package/coverage/lcov.info +6624 -6141
  12. package/data_layer/CreateAttributeObject.jsc +0 -0
  13. package/data_layer/CreateTableObject.jsc +0 -0
  14. package/data_layer/DataLayerObjects.jsc +0 -0
  15. package/data_layer/DeleteBeforeObject.jsc +0 -0
  16. package/data_layer/DeleteObject.jsc +0 -0
  17. package/data_layer/DropAttributeObject.jsc +0 -0
  18. package/data_layer/InsertObject.jsc +0 -0
  19. package/data_layer/ReadTransactionLogObject.jsc +0 -0
  20. package/data_layer/SQLSearch.jsc +0 -0
  21. package/data_layer/SearchByConditionsObject.jsc +0 -0
  22. package/data_layer/SearchByHashObject.jsc +0 -0
  23. package/data_layer/SearchObject.jsc +0 -0
  24. package/data_layer/SqlSearchObject.jsc +0 -0
  25. package/data_layer/UpdateObject.jsc +0 -0
  26. package/data_layer/UpsertObject.jsc +0 -0
  27. package/data_layer/bulkLoad.jsc +0 -0
  28. package/data_layer/data_objects/BulkLoadObjects.jsc +0 -0
  29. package/data_layer/data_objects/UpsertObject.jsc +0 -0
  30. package/data_layer/delete.jsc +0 -0
  31. package/data_layer/export.jsc +0 -0
  32. package/data_layer/harperBridge/BridgeMethods.jsc +0 -0
  33. package/data_layer/harperBridge/bridgeUtility/checkForNewAttr.jsc +0 -0
  34. package/data_layer/harperBridge/bridgeUtility/convertOperationToTransaction.jsc +0 -0
  35. package/data_layer/harperBridge/bridgeUtility/evaluateTableGetAttributes.jsc +0 -0
  36. package/data_layer/harperBridge/bridgeUtility/insertUpdateReturnObj.jsc +0 -0
  37. package/data_layer/harperBridge/bridgeUtility/insertUpdateValidate.jsc +0 -0
  38. package/data_layer/harperBridge/harperBridge.jsc +0 -0
  39. package/data_layer/harperBridge/lmdbBridge/LMDBBridge.jsc +0 -0
  40. package/data_layer/harperBridge/lmdbBridge/lmdbMethods/DeleteTransactionsBeforeResults.jsc +0 -0
  41. package/data_layer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateAttribute.jsc +0 -0
  42. package/data_layer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateRecords.jsc +0 -0
  43. package/data_layer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateSchema.jsc +0 -0
  44. package/data_layer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateTable.jsc +0 -0
  45. package/data_layer/harperBridge/lmdbBridge/lmdbMethods/lmdbDeleteRecords.jsc +0 -0
  46. package/data_layer/harperBridge/lmdbBridge/lmdbMethods/lmdbDeleteRecordsBefore.jsc +0 -0
  47. package/data_layer/harperBridge/lmdbBridge/lmdbMethods/lmdbDeleteTransactionLogsBefore.jsc +0 -0
  48. package/data_layer/harperBridge/lmdbBridge/lmdbMethods/lmdbDropAttribute.jsc +0 -0
  49. package/data_layer/harperBridge/lmdbBridge/lmdbMethods/lmdbDropSchema.jsc +0 -0
  50. package/data_layer/harperBridge/lmdbBridge/lmdbMethods/lmdbDropTable.jsc +0 -0
  51. package/data_layer/harperBridge/lmdbBridge/lmdbMethods/lmdbGetDataByHash.jsc +0 -0
  52. package/data_layer/harperBridge/lmdbBridge/lmdbMethods/lmdbGetDataByValue.jsc +0 -0
  53. package/data_layer/harperBridge/lmdbBridge/lmdbMethods/lmdbReadTransactionLog.jsc +0 -0
  54. package/data_layer/harperBridge/lmdbBridge/lmdbMethods/lmdbSearchByConditions.jsc +0 -0
  55. package/data_layer/harperBridge/lmdbBridge/lmdbMethods/lmdbSearchByHash.jsc +0 -0
  56. package/data_layer/harperBridge/lmdbBridge/lmdbMethods/lmdbSearchByValue.jsc +0 -0
  57. package/data_layer/harperBridge/lmdbBridge/lmdbMethods/lmdbUpdateRecords.jsc +0 -0
  58. package/data_layer/harperBridge/lmdbBridge/lmdbMethods/lmdbUpsertRecords.jsc +0 -0
  59. package/data_layer/harperBridge/lmdbBridge/lmdbUtility/LMDBCreateAttributeObject.jsc +0 -0
  60. package/data_layer/harperBridge/lmdbBridge/lmdbUtility/LMDBDeleteTransactionObject.jsc +0 -0
  61. package/data_layer/harperBridge/lmdbBridge/lmdbUtility/LMDBInsertTransactionObject.jsc +0 -0
  62. package/data_layer/harperBridge/lmdbBridge/lmdbUtility/LMDBTransactionObject.jsc +0 -0
  63. package/data_layer/harperBridge/lmdbBridge/lmdbUtility/LMDBUpdateTransactionObject.jsc +0 -0
  64. package/data_layer/harperBridge/lmdbBridge/lmdbUtility/LMDBUpsertTransactionObject.jsc +0 -0
  65. package/data_layer/harperBridge/lmdbBridge/lmdbUtility/TableSizeObject.jsc +0 -0
  66. package/data_layer/harperBridge/lmdbBridge/lmdbUtility/ThreadSearchObject.jsc +0 -0
  67. package/data_layer/harperBridge/lmdbBridge/lmdbUtility/initializeHashSearch.jsc +0 -0
  68. package/data_layer/harperBridge/lmdbBridge/lmdbUtility/initializePaths.jsc +0 -0
  69. package/data_layer/harperBridge/lmdbBridge/lmdbUtility/lmdbCheckForNewAttributes.jsc +0 -0
  70. package/data_layer/harperBridge/lmdbBridge/lmdbUtility/lmdbCreateTransactionsEnvironment.jsc +0 -0
  71. package/data_layer/harperBridge/lmdbBridge/lmdbUtility/lmdbDropAllAttributes.jsc +0 -0
  72. package/data_layer/harperBridge/lmdbBridge/lmdbUtility/lmdbGetTableSize.jsc +0 -0
  73. package/data_layer/harperBridge/lmdbBridge/lmdbUtility/lmdbProcessRows.jsc +0 -0
  74. package/data_layer/harperBridge/lmdbBridge/lmdbUtility/lmdbSearch.jsc +0 -0
  75. package/data_layer/harperBridge/lmdbBridge/lmdbUtility/lmdbThreadSearch.jsc +0 -0
  76. package/data_layer/harperBridge/lmdbBridge/lmdbUtility/lmdbWriteTransaction.jsc +0 -0
  77. package/data_layer/hdbInfoController.jsc +0 -0
  78. package/data_layer/insert.jsc +0 -0
  79. package/data_layer/readTransactionLog.jsc +0 -0
  80. package/data_layer/schema.jsc +0 -0
  81. package/data_layer/schemaDescribe.jsc +0 -0
  82. package/data_layer/search.jsc +0 -0
  83. package/data_layer/update.jsc +0 -0
  84. package/events/ClusterStatusEmitter.jsc +0 -0
  85. package/events/SioServerStoppedEvent.jsc +0 -0
  86. package/events/SocketClusterStatusEmitter.jsc +0 -0
  87. package/license/LICENSE +91 -1
  88. package/node_modules/@msgpackr-extract/msgpackr-extract-linux-x64/README.md +1 -0
  89. package/node_modules/{node-addon-api/src/nothing.c → @msgpackr-extract/msgpackr-extract-linux-x64/index.js} +0 -0
  90. package/node_modules/@msgpackr-extract/msgpackr-extract-linux-x64/node.abi93.glibc.node +0 -0
  91. package/node_modules/@msgpackr-extract/msgpackr-extract-linux-x64/node.abi93.musl.node +0 -0
  92. package/node_modules/@msgpackr-extract/msgpackr-extract-linux-x64/node.napi.glibc.node +0 -0
  93. package/node_modules/@msgpackr-extract/msgpackr-extract-linux-x64/node.napi.musl.node +0 -0
  94. package/node_modules/@msgpackr-extract/msgpackr-extract-linux-x64/package.json +53 -0
  95. package/node_modules/{msgpackr-extract → lmdb-store}/.github/workflows/prebuild.yml +9 -10
  96. package/node_modules/lmdb-store/.idea/lmdb-store.iml +12 -0
  97. package/node_modules/lmdb-store/.idea/misc.xml +6 -0
  98. package/node_modules/lmdb-store/.idea/modules.xml +8 -0
  99. package/node_modules/lmdb-store/.idea/workspace.xml +4 -0
  100. package/node_modules/lmdb-store/README.md +393 -388
  101. package/node_modules/lmdb-store/benchmark/index.js +162 -162
  102. package/node_modules/lmdb-store/binding.gyp +79 -88
  103. package/node_modules/lmdb-store/caching.js +113 -113
  104. package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/COPYRIGHT +20 -20
  105. package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/Doxyfile +1631 -1631
  106. package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/LICENSE +47 -47
  107. package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/chacha8.c +183 -183
  108. package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/chacha8.h +14 -14
  109. package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/crypto.c +121 -121
  110. package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/intro.doc +192 -192
  111. package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/mdb.c +12125 -12125
  112. package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/mdb_copy.1 +74 -74
  113. package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/mdb_copy.c +106 -106
  114. package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/mdb_drop.1 +53 -53
  115. package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/mdb_drop.c +154 -154
  116. package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/mdb_dump.1 +94 -94
  117. package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/mdb_dump.c +333 -333
  118. package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/mdb_load.1 +97 -97
  119. package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/mdb_load.c +530 -530
  120. package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/mdb_stat.1 +83 -83
  121. package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/mdb_stat.c +276 -276
  122. package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/midl.c +452 -452
  123. package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/midl.h +208 -208
  124. package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/module.c +101 -101
  125. package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/module.h +16 -16
  126. package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/mtest.c +178 -178
  127. package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/mtest2.c +124 -124
  128. package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/mtest3.c +133 -133
  129. package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/mtest4.c +168 -168
  130. package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/mtest5.c +135 -135
  131. package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/mtest6.c +141 -141
  132. package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/mtest_enc.c +190 -190
  133. package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/mtest_enc2.c +189 -189
  134. package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/mtest_remap.c +177 -177
  135. package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/sample-bdb.txt +73 -73
  136. package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/sample-mdb.txt +62 -62
  137. package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/tooltag +27 -27
  138. package/node_modules/lmdb-store/dependencies/lz4/LICENSE +11 -11
  139. package/node_modules/lmdb-store/dependencies/lz4/lib/README.md +137 -137
  140. package/node_modules/lmdb-store/dependencies/lz4/lib/dll/example/README.md +69 -69
  141. package/node_modules/lmdb-store/dependencies/lz4/lib/lz4frame.c +1899 -1899
  142. package/node_modules/lmdb-store/dependencies/lz4/lib/xxhash.c +1030 -1030
  143. package/node_modules/lmdb-store/dependencies/lz4/lib/xxhash.h +328 -328
  144. package/node_modules/lmdb-store/dist/index.cjs +2591 -0
  145. package/node_modules/lmdb-store/dist/index.cjs.map +1 -0
  146. package/node_modules/lmdb-store/index.d.ts +323 -323
  147. package/node_modules/lmdb-store/index.js +1274 -1274
  148. package/node_modules/lmdb-store/index.mjs +3 -3
  149. package/node_modules/lmdb-store/package.json +16 -11
  150. package/node_modules/lmdb-store/prebuilds/darwin-arm64/electron.abi98.node +0 -0
  151. package/node_modules/lmdb-store/prebuilds/darwin-arm64/node.abi83.node +0 -0
  152. package/node_modules/lmdb-store/prebuilds/darwin-arm64/node.abi93.node +0 -0
  153. package/node_modules/lmdb-store/prebuilds/darwin-x64/electron.abi98.node +0 -0
  154. package/node_modules/lmdb-store/prebuilds/darwin-x64/node.abi83.node +0 -0
  155. package/node_modules/lmdb-store/prebuilds/darwin-x64/node.abi93.node +0 -0
  156. package/node_modules/lmdb-store/prebuilds/linux-arm64/electron.abi98.node +0 -0
  157. package/node_modules/lmdb-store/prebuilds/linux-arm64/node.abi83.node +0 -0
  158. package/node_modules/lmdb-store/prebuilds/linux-arm64/node.abi93.node +0 -0
  159. package/node_modules/lmdb-store/prebuilds/linux-x64/electron.abi98.node +0 -0
  160. package/node_modules/lmdb-store/prebuilds/linux-x64/node.abi83.musl.node +0 -0
  161. package/node_modules/lmdb-store/prebuilds/linux-x64/node.abi83.node +0 -0
  162. package/node_modules/lmdb-store/prebuilds/linux-x64/node.abi93.musl.node +0 -0
  163. package/node_modules/lmdb-store/prebuilds/linux-x64/node.abi93.node +0 -0
  164. package/node_modules/lmdb-store/prebuilds/win32-x64/electron.abi98.node +0 -0
  165. package/node_modules/lmdb-store/prebuilds/win32-x64/node.abi83.node +0 -0
  166. package/node_modules/lmdb-store/prebuilds/win32-x64/node.abi93.node +0 -0
  167. package/node_modules/lmdb-store/src/compression.cpp +181 -181
  168. package/node_modules/lmdb-store/src/cursor.cpp +407 -407
  169. package/node_modules/lmdb-store/src/dbi.cpp +354 -354
  170. package/node_modules/lmdb-store/src/env.cpp +1134 -1134
  171. package/node_modules/lmdb-store/src/misc.cpp +528 -528
  172. package/node_modules/lmdb-store/src/node-lmdb.cpp +44 -44
  173. package/node_modules/lmdb-store/src/node-lmdb.h +965 -965
  174. package/node_modules/lmdb-store/src/ordered-binary.cpp +337 -337
  175. package/node_modules/lmdb-store/src/txn.cpp +513 -513
  176. package/node_modules/lmdb-store/src/v8-fast-api-calls.h +419 -419
  177. package/node_modules/lmdb-store/src/windows.c +30 -30
  178. package/node_modules/lmdb-store/test/index.test.js +584 -584
  179. package/node_modules/lmdb-store/test/node-lmdb.test.js +1525 -1525
  180. package/node_modules/lmdb-store/test/threads.js +100 -100
  181. package/node_modules/lmdb-store/util/ArrayLikeIterable.js +136 -136
  182. package/node_modules/lmdb-store/util/WeakValueMap.js +40 -40
  183. package/node_modules/lmdb-store/util/upgrade-lmdb.js +46 -46
  184. package/node_modules/lmdb-store/util/when.js +8 -8
  185. package/node_modules/microtime/.github/workflows/release.yml +76 -0
  186. package/node_modules/microtime/.github/workflows/test.yml +46 -0
  187. package/node_modules/microtime/README.md +0 -2
  188. package/node_modules/microtime/binding.gyp +28 -10
  189. package/node_modules/microtime/package.json +25 -20
  190. package/node_modules/microtime/prebuilds/darwin-x64+arm64/electron.napi.node +0 -0
  191. package/node_modules/microtime/prebuilds/darwin-x64+arm64/node.napi.node +0 -0
  192. package/node_modules/microtime/prebuilds/linux-arm/node.napi.armv7.node +0 -0
  193. package/node_modules/microtime/prebuilds/linux-arm64/node.napi.armv8.node +0 -0
  194. package/node_modules/microtime/prebuilds/linux-x64/electron.napi.node +0 -0
  195. package/node_modules/microtime/prebuilds/linux-x64/node.napi.node +0 -0
  196. package/node_modules/microtime/prebuilds/win32-ia32/electron.napi.node +0 -0
  197. package/node_modules/microtime/prebuilds/win32-ia32/node.napi.node +0 -0
  198. package/node_modules/microtime/prebuilds/win32-x64/electron.napi.node +0 -0
  199. package/node_modules/microtime/prebuilds/win32-x64/node.napi.node +0 -0
  200. package/node_modules/msgpackr/dist/index.js +1929 -1917
  201. package/node_modules/msgpackr/dist/index.min.js +67 -68
  202. package/node_modules/msgpackr/dist/node.cjs +1994 -1980
  203. package/node_modules/msgpackr/dist/test.js +683 -1235
  204. package/node_modules/msgpackr/index.d.ts +23 -12
  205. package/node_modules/msgpackr/node-index.js +23 -21
  206. package/node_modules/msgpackr/pack.js +935 -931
  207. package/node_modules/msgpackr/package.json +24 -12
  208. package/node_modules/msgpackr/unpack.d.ts +52 -50
  209. package/node_modules/msgpackr/unpack.js +1061 -1053
  210. package/node_modules/msgpackr-extract/bin/download-prebuilds.js +11 -0
  211. package/node_modules/msgpackr-extract/binding.gyp +22 -5
  212. package/node_modules/msgpackr-extract/index.js +1 -1
  213. package/node_modules/msgpackr-extract/package.json +46 -21
  214. package/node_modules/msgpackr-extract/src/.vs/ProjectSettings.json +3 -0
  215. package/node_modules/msgpackr-extract/src/.vs/VSWorkspaceState.json +7 -0
  216. package/node_modules/msgpackr-extract/src/.vs/slnx.sqlite +0 -0
  217. package/node_modules/msgpackr-extract/src/.vs/src/v16/.suo +0 -0
  218. package/node_modules/msgpackr-extract/src/.vs/src/v16/Browse.VC.db +0 -0
  219. package/node_modules/msgpackr-extract/{prebuilds/darwin-x64/node.abi72.node → src/.vs/src/v16/Browse.VC.db-shm} +0 -0
  220. package/node_modules/msgpackr-extract/src/.vs/src/v16/Browse.VC.db-wal +0 -0
  221. package/node_modules/msgpackr-extract/src/extract.cpp +272 -269
  222. package/node_modules/nan/package.json +0 -1
  223. package/node_modules/node-addon-api/README.md +146 -53
  224. package/node_modules/node-addon-api/common.gypi +21 -0
  225. package/node_modules/node-addon-api/except.gypi +25 -0
  226. package/node_modules/node-addon-api/index.js +7 -41
  227. package/node_modules/node-addon-api/napi-inl.deprecated.h +8 -8
  228. package/node_modules/node-addon-api/napi-inl.h +2795 -633
  229. package/node_modules/node-addon-api/napi.h +1547 -597
  230. package/node_modules/node-addon-api/node_api.gyp +9 -0
  231. package/node_modules/node-addon-api/noexcept.gypi +26 -0
  232. package/node_modules/node-addon-api/nothing.c +0 -0
  233. package/node_modules/node-addon-api/package-support.json +21 -0
  234. package/node_modules/node-addon-api/package.json +203 -13
  235. package/node_modules/node-addon-api/tools/README.md +12 -6
  236. package/node_modules/node-addon-api/tools/clang-format.js +71 -0
  237. package/node_modules/node-addon-api/tools/conversion.js +4 -8
  238. package/node_modules/node-addon-api/tools/eslint-format.js +71 -0
  239. package/node_modules/node-gyp-build/README.md +17 -14
  240. package/node_modules/node-gyp-build/bin.js +28 -15
  241. package/node_modules/node-gyp-build/index.js +145 -34
  242. package/node_modules/node-gyp-build/package.json +18 -15
  243. package/node_modules/{lmdb-store/node_modules/node-gyp-build → node-gyp-build-optional-packages}/LICENSE +0 -0
  244. package/node_modules/{lmdb-store/node_modules/node-gyp-build → node-gyp-build-optional-packages}/README.md +0 -0
  245. package/node_modules/{lmdb-store/node_modules/node-gyp-build → node-gyp-build-optional-packages}/bin.js +1 -1
  246. package/node_modules/{lmdb-store/node_modules/node-gyp-build → node-gyp-build-optional-packages}/build-test.js +0 -0
  247. package/node_modules/{lmdb-store/node_modules/node-gyp-build → node-gyp-build-optional-packages}/index.js +17 -11
  248. package/node_modules/{lmdb-store/node_modules/node-gyp-build → node-gyp-build-optional-packages}/optional.js +0 -0
  249. package/node_modules/{msgpackr-extract/node_modules/node-gyp-build → node-gyp-build-optional-packages}/package.json +17 -17
  250. package/package.json +12 -11
  251. package/security/JWTObjects.jsc +0 -0
  252. package/security/auth.jsc +0 -0
  253. package/security/cryptoHash.jsc +0 -0
  254. package/security/data_objects/PermissionAttributeResponseObject.jsc +0 -0
  255. package/security/data_objects/PermissionResponseObject.jsc +0 -0
  256. package/security/data_objects/PermissionTableResponseObject.jsc +0 -0
  257. package/security/permissionsTranslator.jsc +0 -0
  258. package/security/role.jsc +0 -0
  259. package/security/tokenAuthentication.jsc +0 -0
  260. package/security/user.jsc +0 -0
  261. package/server/ClusteringOriginObject.jsc +0 -0
  262. package/server/JobObject.jsc +0 -0
  263. package/server/clustering/ClusterStatusObject.jsc +0 -0
  264. package/server/clustering/NodeObject.jsc +0 -0
  265. package/server/clustering/clusterUtilities.jsc +0 -0
  266. package/server/configuration.jsc +0 -0
  267. package/server/customFunctions/customFunctionsServer.jsc +0 -0
  268. package/server/customFunctions/helpers/getCORSOptions.jsc +0 -0
  269. package/server/customFunctions/helpers/getHeaderTimeoutConfig.jsc +0 -0
  270. package/server/customFunctions/helpers/getServerOptions.jsc +0 -0
  271. package/server/customFunctions/operations.jsc +0 -0
  272. package/server/customFunctions/operationsValidation.jsc +0 -0
  273. package/server/harperdb/hdbServer.jsc +0 -0
  274. package/server/ipc/IPCClient.jsc +0 -0
  275. package/server/ipc/hdbIpcServer.jsc +0 -0
  276. package/server/ipc/serverHandlers.jsc +0 -0
  277. package/server/ipc/utility/IPCEventObject.jsc +0 -0
  278. package/server/ipc/utility/ipcUtils.jsc +0 -0
  279. package/server/jobRunner.jsc +0 -0
  280. package/server/jobThread.jsc +0 -0
  281. package/server/jobs.jsc +0 -0
  282. package/server/serverHelpers/OperationFunctionObject.jsc +0 -0
  283. package/server/serverHelpers/requestTimePlugin.jsc +0 -0
  284. package/server/serverHelpers/serverHandlers.jsc +0 -0
  285. package/server/serverHelpers/serverUtilities.jsc +0 -0
  286. package/server/socketcluster/Server.jsc +0 -0
  287. package/server/socketcluster/broker.jsc +0 -0
  288. package/server/socketcluster/connector/HDBSocketConnector.jsc +0 -0
  289. package/server/socketcluster/connector/InterNodeSocketConnector.jsc +0 -0
  290. package/server/socketcluster/connector/SocketConnector.jsc +0 -0
  291. package/server/socketcluster/connector/spawnSCConnection.jsc +0 -0
  292. package/server/socketcluster/decisionMatrix/CoreDecisionMatrix.jsc +0 -0
  293. package/server/socketcluster/decisionMatrix/DecisionMatrixIF.jsc +0 -0
  294. package/server/socketcluster/decisionMatrix/rules/AssignToHdbChildWorkerRule.jsc +0 -0
  295. package/server/socketcluster/decisionMatrix/rules/CallRoomMsgHandlerRule.jsc +0 -0
  296. package/server/socketcluster/decisionMatrix/rules/CleanDataObjectRule.jsc +0 -0
  297. package/server/socketcluster/decisionMatrix/rules/CommandCollection.jsc +0 -0
  298. package/server/socketcluster/decisionMatrix/rules/DummyRule.jsc +0 -0
  299. package/server/socketcluster/decisionMatrix/rules/RulesIF.jsc +0 -0
  300. package/server/socketcluster/decisionMatrix/rules/StripHdbHeaderRule.jsc +0 -0
  301. package/server/socketcluster/decisionMatrix/rules/TestRule.jsc +0 -0
  302. package/server/socketcluster/handlers/NodeConnectionsHandler.jsc +0 -0
  303. package/server/socketcluster/handlers/SCServer.jsc +0 -0
  304. package/server/socketcluster/handlers/ServerSocket.jsc +0 -0
  305. package/server/socketcluster/interNodeConnectionLauncher.jsc +0 -0
  306. package/server/socketcluster/messageQueue/MessageQueueIF.jsc +0 -0
  307. package/server/socketcluster/middleware/AuthMiddleware.jsc +0 -0
  308. package/server/socketcluster/middleware/ConnectionNameCheckMiddleware.jsc +0 -0
  309. package/server/socketcluster/middleware/GenericMiddleware.jsc +0 -0
  310. package/server/socketcluster/middleware/MessagePrepMiddleware.jsc +0 -0
  311. package/server/socketcluster/middleware/MiddlewareFactory.jsc +0 -0
  312. package/server/socketcluster/middleware/MiddlewareIF.jsc +0 -0
  313. package/server/socketcluster/middleware/OriginatorCheckMiddleware.jsc +0 -0
  314. package/server/socketcluster/middleware/RequestDataValidMiddleware.jsc +0 -0
  315. package/server/socketcluster/middleware/StampOriginatorMiddleware.jsc +0 -0
  316. package/server/socketcluster/middleware/StampRequestMiddleware.jsc +0 -0
  317. package/server/socketcluster/observer/EventableIF.jsc +0 -0
  318. package/server/socketcluster/room/AddUserRoom.jsc +0 -0
  319. package/server/socketcluster/room/AlterUserRoom.jsc +0 -0
  320. package/server/socketcluster/room/CoreRoom.jsc +0 -0
  321. package/server/socketcluster/room/CreateAttributeRoom.jsc +0 -0
  322. package/server/socketcluster/room/CreateSchemaRoom.jsc +0 -0
  323. package/server/socketcluster/room/CreateTableRoom.jsc +0 -0
  324. package/server/socketcluster/room/DropUserRoom.jsc +0 -0
  325. package/server/socketcluster/room/HDBNodeRoom.jsc +0 -0
  326. package/server/socketcluster/room/RoomIF.jsc +0 -0
  327. package/server/socketcluster/room/RoomMessageObjects.jsc +0 -0
  328. package/server/socketcluster/room/UsersRoom.jsc +0 -0
  329. package/server/socketcluster/room/WatchHDBWorkersRoom.jsc +0 -0
  330. package/server/socketcluster/room/WorkerRoom.jsc +0 -0
  331. package/server/socketcluster/room/roomFactory.jsc +0 -0
  332. package/server/socketcluster/socketClusterObjects.jsc +0 -0
  333. package/server/socketcluster/types.jsc +0 -0
  334. package/server/socketcluster/util/clusterData.jsc +0 -0
  335. package/server/socketcluster/util/socketClusterUtils.jsc +0 -0
  336. package/server/socketcluster/worker/ClusterWorker.jsc +0 -0
  337. package/server/socketcluster/worker/WorkerIF.jsc +0 -0
  338. package/server/socketcluster/worker/WorkerObjects.jsc +0 -0
  339. package/server/transactToClusteringUtilities.jsc +0 -0
  340. package/sqlTranslator/SelectValidator.jsc +0 -0
  341. package/sqlTranslator/alasqlFunctionImporter.jsc +0 -0
  342. package/sqlTranslator/conditionPatterns.jsc +0 -0
  343. package/sqlTranslator/deleteTranslator.jsc +0 -0
  344. package/sqlTranslator/index.jsc +0 -0
  345. package/sqlTranslator/sql_statement_bucket.jsc +0 -0
  346. package/upgrade/EnvironmentVariable.jsc +0 -0
  347. package/upgrade/UpgradeDirective.jsc +0 -0
  348. package/upgrade/UpgradeObjects.jsc +0 -0
  349. package/upgrade/directives/3-0-0.jsc +0 -0
  350. package/upgrade/directives/3-1-0.jsc +0 -0
  351. package/upgrade/directives/directivesController.jsc +0 -0
  352. package/upgrade/directives/upgrade_scripts/3_0_0_reindex_script.jsc +0 -0
  353. package/upgrade/directivesManager.jsc +0 -0
  354. package/upgrade/lmdb/nodeLMDB/DBIDefinition.jsc +0 -0
  355. package/upgrade/lmdb/nodeLMDB/OpenDBIObject.jsc +0 -0
  356. package/upgrade/lmdb/nodeLMDB/OpenEnvironmentObject.jsc +0 -0
  357. package/upgrade/lmdb/nodeLMDB/commonErrors.jsc +0 -0
  358. package/upgrade/lmdb/nodeLMDB/commonUtility.jsc +0 -0
  359. package/upgrade/lmdb/nodeLMDB/environmentUtility.jsc +0 -0
  360. package/upgrade/lmdb/nodeLMDB/terms.jsc +0 -0
  361. package/upgrade/upgradePrompt.jsc +0 -0
  362. package/upgrade/upgradeUtilities.jsc +0 -0
  363. package/utility/AWS/AWSConnector.jsc +0 -0
  364. package/utility/OperationFunctionCaller.jsc +0 -0
  365. package/utility/common_utils.jsc +0 -0
  366. package/utility/environment/SystemInformationObject.jsc +0 -0
  367. package/utility/environment/SystemInformationOperation.jsc +0 -0
  368. package/utility/environment/environmentManager.jsc +0 -0
  369. package/utility/environment/systemInformation.jsc +0 -0
  370. package/utility/errors/commonErrors.jsc +0 -0
  371. package/utility/errors/hdbError.jsc +0 -0
  372. package/utility/functions/date/dateFunctions.jsc +0 -0
  373. package/utility/functions/geo.jsc +0 -0
  374. package/utility/functions/math/avg.jsc +0 -0
  375. package/utility/functions/math/count.jsc +0 -0
  376. package/utility/functions/sql/alaSQLExtension.jsc +0 -0
  377. package/utility/functions/string/compare.jsc +0 -0
  378. package/utility/globalSchema.jsc +0 -0
  379. package/utility/hdbTerms.jsc +0 -0
  380. package/utility/install/checkJWTTokensExist.jsc +0 -0
  381. package/utility/install/installer.jsc +0 -0
  382. package/utility/install_user_permission.jsc +0 -0
  383. package/utility/lmdb/DBIDefinition.jsc +0 -0
  384. package/utility/lmdb/DeleteRecordsResponseObject.jsc +0 -0
  385. package/utility/lmdb/InsertRecordsResponseObject.jsc +0 -0
  386. package/utility/lmdb/OpenDBIObject.jsc +0 -0
  387. package/utility/lmdb/OpenEnvironmentObject.jsc +0 -0
  388. package/utility/lmdb/UpdateRecordsResponseObject.jsc +0 -0
  389. package/utility/lmdb/UpsertRecordsResponseObject.jsc +0 -0
  390. package/utility/lmdb/cleanLMDBMap.jsc +0 -0
  391. package/utility/lmdb/commonUtility.jsc +0 -0
  392. package/utility/lmdb/deleteUtility.jsc +0 -0
  393. package/utility/lmdb/environmentUtility.jsc +0 -0
  394. package/utility/lmdb/searchCursorFunctions.jsc +0 -0
  395. package/utility/lmdb/searchUtility.jsc +0 -0
  396. package/utility/lmdb/terms.jsc +0 -0
  397. package/utility/lmdb/writeUtility.jsc +0 -0
  398. package/utility/logging/harper_logger.jsc +0 -0
  399. package/utility/mount_hdb.jsc +0 -0
  400. package/utility/npmUtilities.jsc +0 -0
  401. package/utility/operation_authorization.jsc +0 -0
  402. package/utility/password.jsc +0 -0
  403. package/utility/pm2/servicesConfig.jsc +0 -0
  404. package/utility/pm2/utilityFunctions.jsc +0 -0
  405. package/utility/psList.jsc +0 -0
  406. package/utility/registration/hdb_license.jsc +0 -0
  407. package/utility/registration/licenseObjects.jsc +0 -0
  408. package/utility/registration/registrationHandler.jsc +0 -0
  409. package/utility/scripts/restartHdb.jsc +0 -0
  410. package/utility/signalling.jsc +0 -0
  411. package/utility/system_info.jsc +0 -0
  412. package/validation/bulkDeleteValidator.jsc +0 -0
  413. package/validation/check_permissions.jsc +0 -0
  414. package/validation/clustering/configureValidator.jsc +0 -0
  415. package/validation/common_validators.jsc +0 -0
  416. package/validation/conditionalDeleteValidator.jsc +0 -0
  417. package/validation/deleteValidator.jsc +0 -0
  418. package/validation/fileLoadValidator.jsc +0 -0
  419. package/validation/insertValidator.jsc +0 -0
  420. package/validation/nodeSubscriptionValidator.jsc +0 -0
  421. package/validation/nodeValidator.jsc +0 -0
  422. package/validation/readLogValidator.jsc +0 -0
  423. package/validation/registration/license_key_object.jsc +0 -0
  424. package/validation/role_validation.jsc +0 -0
  425. package/validation/schemaMetadataValidator.jsc +0 -0
  426. package/validation/schema_validator.jsc +0 -0
  427. package/validation/searchValidator.jsc +0 -0
  428. package/validation/user_validation.jsc +0 -0
  429. package/validation/validationWrapper.jsc +0 -0
  430. package/node_modules/lmdb-store/build/Makefile +0 -324
  431. package/node_modules/lmdb-store/build/Release/.deps/Release/lmdb-store.node.d +0 -1
  432. package/node_modules/lmdb-store/build/Release/.deps/Release/obj.target/lmdb-store/dependencies/lmdb/libraries/liblmdb/chacha8.o.d +0 -6
  433. package/node_modules/lmdb-store/build/Release/.deps/Release/obj.target/lmdb-store/dependencies/lmdb/libraries/liblmdb/mdb.o.d +0 -8
  434. package/node_modules/lmdb-store/build/Release/.deps/Release/obj.target/lmdb-store/dependencies/lmdb/libraries/liblmdb/midl.o.d +0 -8
  435. package/node_modules/lmdb-store/build/Release/.deps/Release/obj.target/lmdb-store/dependencies/lz4/lib/lz4.o.d +0 -5
  436. package/node_modules/lmdb-store/build/Release/.deps/Release/obj.target/lmdb-store/src/compression.o.d +0 -72
  437. package/node_modules/lmdb-store/build/Release/.deps/Release/obj.target/lmdb-store/src/cursor.o.d +0 -73
  438. package/node_modules/lmdb-store/build/Release/.deps/Release/obj.target/lmdb-store/src/dbi.o.d +0 -73
  439. package/node_modules/lmdb-store/build/Release/.deps/Release/obj.target/lmdb-store/src/env.o.d +0 -73
  440. package/node_modules/lmdb-store/build/Release/.deps/Release/obj.target/lmdb-store/src/misc.o.d +0 -73
  441. package/node_modules/lmdb-store/build/Release/.deps/Release/obj.target/lmdb-store/src/node-lmdb.o.d +0 -73
  442. package/node_modules/lmdb-store/build/Release/.deps/Release/obj.target/lmdb-store/src/ordered-binary.o.d +0 -73
  443. package/node_modules/lmdb-store/build/Release/.deps/Release/obj.target/lmdb-store/src/txn.o.d +0 -73
  444. package/node_modules/lmdb-store/build/Release/.deps/Release/obj.target/lmdb-store/src/windows.o.d +0 -3
  445. package/node_modules/lmdb-store/build/Release/.deps/Release/obj.target/lmdb-store.node.d +0 -1
  446. package/node_modules/lmdb-store/build/Release/lmdb-store.node +0 -0
  447. package/node_modules/lmdb-store/build/Release/obj.target/lmdb-store/dependencies/lmdb/libraries/liblmdb/chacha8.o +0 -0
  448. package/node_modules/lmdb-store/build/Release/obj.target/lmdb-store/dependencies/lmdb/libraries/liblmdb/mdb.o +0 -0
  449. package/node_modules/lmdb-store/build/Release/obj.target/lmdb-store/dependencies/lmdb/libraries/liblmdb/midl.o +0 -0
  450. package/node_modules/lmdb-store/build/Release/obj.target/lmdb-store/dependencies/lz4/lib/lz4.o +0 -0
  451. package/node_modules/lmdb-store/build/Release/obj.target/lmdb-store/src/compression.o +0 -0
  452. package/node_modules/lmdb-store/build/Release/obj.target/lmdb-store/src/cursor.o +0 -0
  453. package/node_modules/lmdb-store/build/Release/obj.target/lmdb-store/src/dbi.o +0 -0
  454. package/node_modules/lmdb-store/build/Release/obj.target/lmdb-store/src/env.o +0 -0
  455. package/node_modules/lmdb-store/build/Release/obj.target/lmdb-store/src/misc.o +0 -0
  456. package/node_modules/lmdb-store/build/Release/obj.target/lmdb-store/src/node-lmdb.o +0 -0
  457. package/node_modules/lmdb-store/build/Release/obj.target/lmdb-store/src/ordered-binary.o +0 -0
  458. package/node_modules/lmdb-store/build/Release/obj.target/lmdb-store/src/txn.o +0 -0
  459. package/node_modules/lmdb-store/build/Release/obj.target/lmdb-store/src/windows.o +0 -0
  460. package/node_modules/lmdb-store/build/Release/obj.target/lmdb-store.node +0 -0
  461. package/node_modules/lmdb-store/build/binding.Makefile +0 -6
  462. package/node_modules/lmdb-store/build/config.gypi +0 -426
  463. package/node_modules/lmdb-store/build/lmdb-store.target.mk +0 -206
  464. package/node_modules/lmdb-store/node_modules/node-gyp-build/package.json +0 -60
  465. package/node_modules/lmdb-store/prebuilds/darwin-x64/electron.abi87.node +0 -0
  466. package/node_modules/lmdb-store/prebuilds/darwin-x64/node.abi72.node +0 -0
  467. package/node_modules/lmdb-store/prebuilds/darwin-x64/node.abi88.node +0 -0
  468. package/node_modules/lmdb-store/prebuilds/win32-x64/electron.abi87.node +0 -0
  469. package/node_modules/lmdb-store/prebuilds/win32-x64/node.abi72.node +0 -0
  470. package/node_modules/lmdb-store/prebuilds/win32-x64/node.abi88.node +0 -0
  471. package/node_modules/microtime/prebuilds/darwin-x64/electron-napi.node +0 -0
  472. package/node_modules/microtime/prebuilds/darwin-x64/node-napi.node +0 -0
  473. package/node_modules/microtime/prebuilds/linux-arm/electron-napi.node +0 -0
  474. package/node_modules/microtime/prebuilds/linux-arm/node-napi.node +0 -0
  475. package/node_modules/microtime/prebuilds/linux-x64/electron-napi.node +0 -0
  476. package/node_modules/microtime/prebuilds/linux-x64/node-napi.node +0 -0
  477. package/node_modules/microtime/prebuilds/win32-x64/electron-napi.node +0 -0
  478. package/node_modules/microtime/prebuilds/win32-x64/node-napi.node +0 -0
  479. package/node_modules/msgpackr-extract/.circleci/config.yml +0 -19
  480. package/node_modules/msgpackr-extract/.travis.yml +0 -30
  481. package/node_modules/msgpackr-extract/node_modules/node-gyp-build/LICENSE +0 -21
  482. package/node_modules/msgpackr-extract/node_modules/node-gyp-build/README.md +0 -58
  483. package/node_modules/msgpackr-extract/node_modules/node-gyp-build/bin.js +0 -77
  484. package/node_modules/msgpackr-extract/node_modules/node-gyp-build/build-test.js +0 -19
  485. package/node_modules/msgpackr-extract/node_modules/node-gyp-build/index.js +0 -202
  486. package/node_modules/msgpackr-extract/node_modules/node-gyp-build/optional.js +0 -7
  487. package/node_modules/msgpackr-extract/prebuilds/darwin-arm64/electron.abi98.node +0 -0
  488. package/node_modules/msgpackr-extract/prebuilds/darwin-arm64/node.abi102.node +0 -0
  489. package/node_modules/msgpackr-extract/prebuilds/darwin-arm64/node.abi83.node +0 -0
  490. package/node_modules/msgpackr-extract/prebuilds/darwin-arm64/node.abi93.node +0 -0
  491. package/node_modules/msgpackr-extract/prebuilds/darwin-x64/electron.abi98.node +0 -0
  492. package/node_modules/msgpackr-extract/prebuilds/darwin-x64/node.abi102.node +0 -0
  493. package/node_modules/msgpackr-extract/prebuilds/darwin-x64/node.abi83.node +0 -0
  494. package/node_modules/msgpackr-extract/prebuilds/darwin-x64/node.abi88.node +0 -0
  495. package/node_modules/msgpackr-extract/prebuilds/darwin-x64/node.abi93.node +0 -0
  496. package/node_modules/msgpackr-extract/prebuilds/linux-arm64/electron.abi98.node +0 -0
  497. package/node_modules/msgpackr-extract/prebuilds/linux-arm64/node.abi102.node +0 -0
  498. package/node_modules/msgpackr-extract/prebuilds/linux-arm64/node.abi83.node +0 -0
  499. package/node_modules/msgpackr-extract/prebuilds/linux-arm64/node.abi93.node +0 -0
  500. package/node_modules/msgpackr-extract/prebuilds/linux-x64/electron.abi98.node +0 -0
  501. package/node_modules/msgpackr-extract/prebuilds/linux-x64/node.abi102.musl.node +0 -0
  502. package/node_modules/msgpackr-extract/prebuilds/linux-x64/node.abi102.node +0 -0
  503. package/node_modules/msgpackr-extract/prebuilds/linux-x64/node.abi72.musl.node +0 -0
  504. package/node_modules/msgpackr-extract/prebuilds/linux-x64/node.abi72.node +0 -0
  505. package/node_modules/msgpackr-extract/prebuilds/linux-x64/node.abi83.musl.node +0 -0
  506. package/node_modules/msgpackr-extract/prebuilds/linux-x64/node.abi83.node +0 -0
  507. package/node_modules/msgpackr-extract/prebuilds/linux-x64/node.abi88.node +0 -0
  508. package/node_modules/msgpackr-extract/prebuilds/linux-x64/node.abi93.musl.node +0 -0
  509. package/node_modules/msgpackr-extract/prebuilds/linux-x64/node.abi93.node +0 -0
  510. package/node_modules/msgpackr-extract/prebuilds/win32-x64/electron.abi98.node +0 -0
  511. package/node_modules/msgpackr-extract/prebuilds/win32-x64/node.abi102.node +0 -0
  512. package/node_modules/msgpackr-extract/prebuilds/win32-x64/node.abi72.node +0 -0
  513. package/node_modules/msgpackr-extract/prebuilds/win32-x64/node.abi83.node +0 -0
  514. package/node_modules/msgpackr-extract/prebuilds/win32-x64/node.abi88.node +0 -0
  515. package/node_modules/msgpackr-extract/prebuilds/win32-x64/node.abi93.node +0 -0
  516. package/node_modules/node-addon-api/.editorconfig +0 -8
  517. package/node_modules/node-addon-api/.travis.yml +0 -65
  518. package/node_modules/node-addon-api/CHANGELOG.md +0 -325
  519. package/node_modules/node-addon-api/CODE_OF_CONDUCT.md +0 -4
  520. package/node_modules/node-addon-api/CONTRIBUTING.md +0 -66
  521. package/node_modules/node-addon-api/appveyor.yml +0 -48
  522. package/node_modules/node-addon-api/doc/Doxyfile +0 -2450
  523. package/node_modules/node-addon-api/doc/array_buffer.md +0 -129
  524. package/node_modules/node-addon-api/doc/async_context.md +0 -76
  525. package/node_modules/node-addon-api/doc/async_operations.md +0 -31
  526. package/node_modules/node-addon-api/doc/async_worker.md +0 -397
  527. package/node_modules/node-addon-api/doc/basic_types.md +0 -415
  528. package/node_modules/node-addon-api/doc/bigint.md +0 -92
  529. package/node_modules/node-addon-api/doc/boolean.md +0 -64
  530. package/node_modules/node-addon-api/doc/buffer.md +0 -140
  531. package/node_modules/node-addon-api/doc/callback_scope.md +0 -54
  532. package/node_modules/node-addon-api/doc/callbackinfo.md +0 -97
  533. package/node_modules/node-addon-api/doc/checker-tool.md +0 -32
  534. package/node_modules/node-addon-api/doc/class_property_descriptor.md +0 -118
  535. package/node_modules/node-addon-api/doc/cmake-js.md +0 -19
  536. package/node_modules/node-addon-api/doc/conversion-tool.md +0 -28
  537. package/node_modules/node-addon-api/doc/creating_a_release.md +0 -62
  538. package/node_modules/node-addon-api/doc/dataview.md +0 -244
  539. package/node_modules/node-addon-api/doc/env.md +0 -63
  540. package/node_modules/node-addon-api/doc/error.md +0 -115
  541. package/node_modules/node-addon-api/doc/error_handling.md +0 -186
  542. package/node_modules/node-addon-api/doc/escapable_handle_scope.md +0 -82
  543. package/node_modules/node-addon-api/doc/external.md +0 -59
  544. package/node_modules/node-addon-api/doc/function.md +0 -294
  545. package/node_modules/node-addon-api/doc/function_reference.md +0 -238
  546. package/node_modules/node-addon-api/doc/generator.md +0 -13
  547. package/node_modules/node-addon-api/doc/handle_scope.md +0 -65
  548. package/node_modules/node-addon-api/doc/memory_management.md +0 -27
  549. package/node_modules/node-addon-api/doc/node-gyp.md +0 -82
  550. package/node_modules/node-addon-api/doc/number.md +0 -163
  551. package/node_modules/node-addon-api/doc/object.md +0 -202
  552. package/node_modules/node-addon-api/doc/object_lifetime_management.md +0 -83
  553. package/node_modules/node-addon-api/doc/object_reference.md +0 -117
  554. package/node_modules/node-addon-api/doc/object_wrap.md +0 -546
  555. package/node_modules/node-addon-api/doc/prebuild_tools.md +0 -16
  556. package/node_modules/node-addon-api/doc/promises.md +0 -74
  557. package/node_modules/node-addon-api/doc/property_descriptor.md +0 -231
  558. package/node_modules/node-addon-api/doc/range_error.md +0 -59
  559. package/node_modules/node-addon-api/doc/reference.md +0 -111
  560. package/node_modules/node-addon-api/doc/setup.md +0 -82
  561. package/node_modules/node-addon-api/doc/string.md +0 -89
  562. package/node_modules/node-addon-api/doc/symbol.md +0 -44
  563. package/node_modules/node-addon-api/doc/threadsafe_function.md +0 -303
  564. package/node_modules/node-addon-api/doc/type_error.md +0 -59
  565. package/node_modules/node-addon-api/doc/typed_array.md +0 -74
  566. package/node_modules/node-addon-api/doc/typed_array_of.md +0 -133
  567. package/node_modules/node-addon-api/doc/value.md +0 -269
  568. package/node_modules/node-addon-api/doc/version_management.md +0 -43
  569. package/node_modules/node-addon-api/doc/working_with_javascript_values.md +0 -14
  570. package/node_modules/node-addon-api/external-napi/node_api.h +0 -7
  571. package/node_modules/node-addon-api/src/node_api.cc +0 -3655
  572. package/node_modules/node-addon-api/src/node_api.gyp +0 -21
  573. package/node_modules/node-addon-api/src/node_api.h +0 -588
  574. package/node_modules/node-addon-api/src/node_api_types.h +0 -115
  575. package/node_modules/node-addon-api/src/node_internals.cc +0 -142
  576. package/node_modules/node-addon-api/src/node_internals.h +0 -157
  577. package/node_modules/node-addon-api/src/util-inl.h +0 -38
  578. package/node_modules/node-addon-api/src/util.h +0 -7
@@ -1,965 +1,965 @@
1
-
2
- // This file is part of lmdb-store
3
- // Copyright (c) 2013-2017 Timur Kristóf
4
- // Licensed to you under the terms of the MIT license
5
- //
6
- // Permission is hereby granted, free of charge, to any person obtaining a copy
7
- // of this software and associated documentation files (the "Software"), to deal
8
- // in the Software without restriction, including without limitation the rights
9
- // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- // copies of the Software, and to permit persons to whom the Software is
11
- // furnished to do so, subject to the following conditions:
12
-
13
- // The above copyright notice and this permission notice shall be included in
14
- // all copies or substantial portions of the Software.
15
-
16
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
- // THE SOFTWARE.
23
-
24
- #ifndef NODE_LMDB_H
25
- #define NODE_LMDB_H
26
-
27
- #include <vector>
28
- #include <algorithm>
29
- #include <v8.h>
30
- #include <node.h>
31
- #include <node_buffer.h>
32
- #include <nan.h>
33
- #include <uv.h>
34
- #include "lmdb.h"
35
- #include "chacha8.h"
36
- #include "lz4.h"
37
-
38
- using namespace v8;
39
- using namespace node;
40
-
41
- enum class NodeLmdbKeyType {
42
-
43
- // Invalid key (used internally by node-lmdb)
44
- InvalidKey = -1,
45
-
46
- // Default key (used internally by node-lmdb)
47
- DefaultKey = 0,
48
-
49
- // UCS-2/UTF-16 with zero terminator - Appears to V8 as string
50
- StringKey = 1,
51
-
52
- // LMDB fixed size integer key with 32 bit keys - Appearts to V8 as an Uint32
53
- Uint32Key = 2,
54
-
55
- // LMDB default key format - Appears to V8 as node::Buffer
56
- BinaryKey = 3,
57
-
58
- };
59
- enum class KeyCreation {
60
- Reset = 0,
61
- Continue = 1,
62
- InArray = 2,
63
- };
64
-
65
- class TxnWrap;
66
- class DbiWrap;
67
- class EnvWrap;
68
- class CursorWrap;
69
- class Compression;
70
- class KeySpace;
71
-
72
- // Exports misc stuff to the module
73
- void setupExportMisc(Local<Object> exports);
74
-
75
- // Helper callback
76
- typedef void (*argtokey_callback_t)(MDB_val &key);
77
-
78
- void consoleLog(Local<Value> val);
79
- void consoleLog(const char *msg);
80
- void consoleLogN(int n);
81
- void setFlagFromValue(int *flags, int flag, const char *name, bool defaultValue, Local<Object> options);
82
- #ifdef _WIN32
83
- extern "C" {
84
- int setProcessMemoryPriority(int priority);
85
- int lowerMemoryPriority(int priority);
86
- int restoreMemoryPriority();
87
- }
88
- #define lowerMemPriority(ew) if (ew->winMemoryPriority < 5) lowerMemoryPriority(ew->winMemoryPriority)
89
- #define restoreMemPriority(ew) if (ew->winMemoryPriority < 5) restoreMemoryPriority()
90
- #else
91
- #define lowerMemPriority(ew)
92
- #define restoreMemPriority(ew)
93
- #endif
94
- void writeValueToEntry(const Local<Value> &str, MDB_val *val);
95
- argtokey_callback_t argToKey(const Local<Value> &val, MDB_val &key, NodeLmdbKeyType keyType, bool &isValid);
96
- bool valueToMDBKey(const Local<Value> &key, MDB_val &val, KeySpace &keySpace);
97
-
98
- NodeLmdbKeyType inferAndValidateKeyType(const Local<Value> &key, const Local<Value> &options, NodeLmdbKeyType dbiKeyType, bool &isValid);
99
- NodeLmdbKeyType inferKeyType(const Local<Value> &val);
100
- NodeLmdbKeyType keyTypeFromOptions(const Local<Value> &val, NodeLmdbKeyType defaultKeyType = NodeLmdbKeyType::DefaultKey);
101
- Local<Value> keyToHandle(MDB_val &key, NodeLmdbKeyType keyType);
102
- Local<Value> getVersionAndUncompress(MDB_val &data, DbiWrap* dw, Local<Value> (*successFunc)(MDB_val&));
103
- NAN_METHOD(getLastVersion);
104
- NAN_METHOD(setLastVersion);
105
- NAN_METHOD(setWinMemoryLimit);
106
- NAN_METHOD(setWinMemoryPriority);
107
- NAN_METHOD(bufferToKeyValue);
108
- NAN_METHOD(keyValueToBuffer);
109
-
110
- class KeySpaceHolder {
111
- public:
112
- uint8_t* data;
113
- KeySpaceHolder* previousSpace;
114
- KeySpaceHolder(KeySpaceHolder* existingPreviousSpace, uint8_t* existingData);
115
- KeySpaceHolder();
116
- ~KeySpaceHolder();
117
- };
118
- class KeySpace : public KeySpaceHolder {
119
- public:
120
- int position;
121
- int size;
122
- bool fixedSize;
123
- uint8_t* getTarget();
124
- KeySpace(bool fixed);
125
- };
126
-
127
- #ifndef thread_local
128
- #ifdef __GNUC__
129
- # define thread_local __thread
130
- #elif __STDC_VERSION__ >= 201112L
131
- # define thread_local _Thread_local
132
- #elif defined(_MSC_VER)
133
- # define thread_local __declspec(thread)
134
- #else
135
- # define thread_local
136
- #endif
137
- #endif
138
-
139
- // markers for special cases
140
- const double ANY_VERSION = -3.3434325325532E-199;
141
- const double NO_EXIST_VERSION = -4.2434325325532E-199;
142
-
143
- static thread_local double lastVersion = 0;
144
- static thread_local DbiWrap* currentDb = nullptr;
145
- static thread_local KeySpace* fixedKeySpace;
146
- KeySpace* getFixedKeySpace();
147
- void setLastVersion(double version);
148
-
149
- Local<Value> valToUtf8(MDB_val &data);
150
- Local<Value> valToString(MDB_val &data);
151
- Local<Value> valToStringUnsafe(MDB_val &data);
152
- Local<Value> valToBinary(MDB_val &data);
153
- Local<Value> valToBinaryUnsafe(MDB_val &data);
154
- Local<Value> valToNumber(MDB_val &data);
155
- Local<Value> valToBoolean(MDB_val &data);
156
-
157
- Local<Value> MDBKeyToValue(MDB_val &data);
158
- void makeGlobalUnsafeBuffer(size_t size);
159
-
160
- int putWithVersion(MDB_txn * txn,
161
- MDB_dbi dbi,
162
- MDB_val * key,
163
- MDB_val * data,
164
- unsigned int flags, double version);
165
-
166
- void throwLmdbError(int rc);
167
-
168
- class TxnWrap;
169
- class DbiWrap;
170
- class EnvWrap;
171
- class CursorWrap;
172
- struct env_path_t {
173
- MDB_env* env;
174
- char* path;
175
- int count;
176
- };
177
-
178
- struct action_t {
179
- int actionType;
180
- MDB_val key;
181
- union {
182
- struct {
183
- DbiWrap* dw;
184
- };
185
- struct {
186
- MDB_val data;
187
- double ifVersion;
188
- double version;
189
- argtokey_callback_t freeValue;
190
- };
191
- };
192
- };
193
-
194
- const int INTERRUPT_BATCH = 9998;
195
- const int RESUME_BATCH = 9999;
196
-
197
- class BatchWorkerBase : public Nan::AsyncProgressWorker {
198
- public:
199
- BatchWorkerBase(Nan::Callback *callback, EnvWrap* envForTxn);
200
- void ContinueBatch(int rc, bool hasStarted);
201
- uv_mutex_t* userCallbackLock;
202
- uv_cond_t* userCallbackCond;
203
- int interruptionStatus;
204
- bool finishedProgress;
205
- EnvWrap* envForTxn;
206
- TxnWrap* currentTxnWrap;
207
- ~BatchWorkerBase();
208
- };
209
-
210
- /*
211
- `Env`
212
- Represents a database environment.
213
- (Wrapper for `MDB_env`)
214
- */
215
- class EnvWrap : public Nan::ObjectWrap {
216
- private:
217
- // List of open read transactions
218
- std::vector<TxnWrap*> readTxns;
219
- // Constructor for TxnWrap
220
- static thread_local Nan::Persistent<Function>* txnCtor;
221
- // Constructor for DbiWrap
222
- static thread_local Nan::Persistent<Function>* dbiCtor;
223
- static uv_mutex_t* envsLock;
224
- static std::vector<env_path_t> envs;
225
- static uv_mutex_t* initMutex();
226
- // compression settings and space
227
- Compression *compression;
228
- BatchWorkerBase* batchWorker;
229
-
230
- // Cleans up stray transactions
231
- void cleanupStrayTxns();
232
-
233
- friend class TxnWrap;
234
- friend class DbiWrap;
235
-
236
- public:
237
- EnvWrap();
238
- ~EnvWrap();
239
- // The wrapped object
240
- MDB_env *env;
241
- // Current write transaction
242
- TxnWrap *currentWriteTxn;
243
-
244
- MDB_txn* currentReadTxn;
245
- bool readTxnRenewed;
246
- // Current raw batch transaction
247
- MDB_txn *currentBatchTxn;
248
- // What memory priority for accessing LMDB data in windows
249
- int winMemoryPriority;
250
- char* syncInstructions;
251
- Nan::Persistent<Function> onReadTxnRenew;
252
- MDB_txn* getReadTxn();
253
-
254
- // Sets up exports for the Env constructor
255
- static void setupExports(Local<Object> exports);
256
-
257
- /*
258
- Constructor of the database environment. You need to `open()` it before you can use it.
259
- (Wrapper for `mdb_env_create`)
260
- */
261
- static NAN_METHOD(ctor);
262
-
263
- /*
264
- Gets statistics about the database environment.
265
- */
266
- static NAN_METHOD(stat);
267
-
268
- /*
269
- Gets statistics about the free space database
270
- */
271
- static NAN_METHOD(freeStat);
272
-
273
- /*
274
- Detaches a buffer from the backing store
275
- */
276
- static NAN_METHOD(detachBuffer);
277
-
278
- /*
279
- Gets information about the database environment.
280
- */
281
- static NAN_METHOD(info);
282
- /*
283
- Check for stale readers
284
- */
285
- static NAN_METHOD(readerCheck);
286
- /*
287
- Print a list of readers
288
- */
289
- static NAN_METHOD(readerList);
290
-
291
- /*
292
- Opens the database environment with the specified options. The options will be used to configure the environment before opening it.
293
- (Wrapper for `mdb_env_open`)
294
-
295
- Parameters:
296
-
297
- * Options object that contains possible configuration options.
298
-
299
- Possible options are:
300
-
301
- * maxDbs: the maximum number of named databases you can have in the environment (default is 1)
302
- * maxReaders: the maximum number of concurrent readers of the environment (default is 126)
303
- * mapSize: maximal size of the memory map (the full environment) in bytes (default is 10485760 bytes)
304
- * path: path to the database environment
305
- */
306
- static NAN_METHOD(open);
307
-
308
- /*
309
- Resizes the maximal size of the memory map. It may be called if no transactions are active in this process.
310
- (Wrapper for `mdb_env_set_mapsize`)
311
-
312
- Parameters:
313
-
314
- * maximal size of the memory map (the full environment) in bytes (default is 10485760 bytes)
315
- */
316
- static NAN_METHOD(resize);
317
-
318
- /*
319
- Copies the database environment to a file.
320
- (Wrapper for `mdb_env_copy2`)
321
-
322
- Parameters:
323
-
324
- * path - Path to the target file
325
- * compact (optional) - Copy using compact setting
326
- * callback - Callback when finished (this is performed asynchronously)
327
- */
328
- static NAN_METHOD(copy);
329
-
330
- /*
331
- Closes the database environment.
332
- (Wrapper for `mdb_env_close`)
333
- */
334
- static NAN_METHOD(close);
335
-
336
- /*
337
- Starts a new transaction in the environment.
338
- (Wrapper for `mdb_txn_begin`)
339
-
340
- Parameters:
341
-
342
- * Options object that contains possible configuration options.
343
-
344
- Possible options are:
345
-
346
- * readOnly: if true, the transaction is read-only
347
- */
348
- static NAN_METHOD(beginTxn);
349
-
350
- /*
351
- Opens a database in the environment.
352
- (Wrapper for `mdb_dbi_open`)
353
-
354
- Parameters:
355
-
356
- * Options object that contains possible configuration options.
357
-
358
- Possible options are:
359
-
360
- * name: the name of the database (or null to use the unnamed database)
361
- * create: if true, the database will be created if it doesn't exist
362
- * keyIsUint32: if true, keys are treated as 32-bit unsigned integers
363
- * dupSort: if true, the database can hold multiple items with the same key
364
- * reverseKey: keys are strings to be compared in reverse order
365
- * dupFixed: if dupSort is true, indicates that the data items are all the same size
366
- * integerDup: duplicate data items are also integers, and should be sorted as such
367
- * reverseDup: duplicate data items should be compared as strings in reverse order
368
- */
369
- static NAN_METHOD(openDbi);
370
-
371
- /*
372
- Flushes all data to the disk asynchronously.
373
- (Asynchronous wrapper for `mdb_env_sync`)
374
-
375
- Parameters:
376
-
377
- * Callback to be executed after the sync is complete.
378
- */
379
- static NAN_METHOD(sync);
380
-
381
- /*
382
- Performs a set of operations asynchronously, automatically wrapping it in its own transaction
383
-
384
- Parameters:
385
-
386
- * Callback to be executed after the sync is complete.
387
- */
388
- static NAN_METHOD(batchWrite);
389
-
390
- static NAN_METHOD(continueBatch);
391
- static NAN_METHOD(resetCurrentReadTxn);
392
- };
393
-
394
- /*
395
- `Txn`
396
- Represents a transaction running on a database environment.
397
- (Wrapper for `MDB_txn`)
398
- */
399
- class TxnWrap : public Nan::ObjectWrap {
400
- private:
401
-
402
- // Reference to the MDB_env of the wrapped MDB_txn
403
- MDB_env *env;
404
-
405
- // Environment wrapper of the current transaction
406
- EnvWrap *ew;
407
- // parent TW, if it is exists
408
- TxnWrap *parentTw;
409
- // The wrapped object
410
- MDB_txn *txn;
411
-
412
- // Flags used with mdb_txn_begin
413
- unsigned int flags;
414
-
415
- friend class CursorWrap;
416
- friend class DbiWrap;
417
- friend class EnvWrap;
418
-
419
- public:
420
- TxnWrap(MDB_env *env, MDB_txn *txn);
421
- ~TxnWrap();
422
- // Remove the current TxnWrap from its EnvWrap
423
- void removeFromEnvWrap();
424
-
425
- // Constructor (not exposed)
426
- static NAN_METHOD(ctor);
427
-
428
- // Helper for all the get methods (not exposed)
429
- static Nan::NAN_METHOD_RETURN_TYPE getCommon(Nan::NAN_METHOD_ARGS_TYPE info, Local<Value> (*successFunc)(MDB_val&));
430
-
431
- // Helper for all the put methods (not exposed)
432
- static Nan::NAN_METHOD_RETURN_TYPE putCommon(Nan::NAN_METHOD_ARGS_TYPE info, void (*fillFunc)(Nan::NAN_METHOD_ARGS_TYPE info, MDB_val&), void (*freeFunc)(MDB_val&));
433
-
434
- /*
435
- Commits the transaction.
436
- (Wrapper for `mdb_txn_commit`)
437
- */
438
- static NAN_METHOD(commit);
439
-
440
- /*
441
- Aborts the transaction.
442
- (Wrapper for `mdb_txn_abort`)
443
- */
444
- static NAN_METHOD(abort);
445
-
446
- /*
447
- Aborts a read-only transaction but makes it renewable with `renew`.
448
- (Wrapper for `mdb_txn_reset`)
449
- */
450
- static NAN_METHOD(reset);
451
-
452
- /*
453
- Renews a read-only transaction after it has been reset.
454
- (Wrapper for `mdb_txn_renew`)
455
- */
456
- static NAN_METHOD(renew);
457
-
458
- /*
459
- Gets string data (JavaScript string type) associated with the given key from a database as UTF-8. You need to open a database in the environment to use this.
460
- This method is not zero-copy and the return value will usable as long as there is a reference to it.
461
- (Wrapper for `mdb_get`)
462
-
463
- Parameters:
464
-
465
- * database instance created with calling `openDbi()` on an `Env` instance
466
- * key for which the value is retrieved
467
- */
468
- static NAN_METHOD(getUtf8);
469
-
470
- /*
471
- Gets string data (JavaScript string type) associated with the given key from a database. You need to open a database in the environment to use this.
472
- This method is not zero-copy and the return value will usable as long as there is a reference to it.
473
- (Wrapper for `mdb_get`)
474
-
475
- Parameters:
476
-
477
- * database instance created with calling `openDbi()` on an `Env` instance
478
- * key for which the value is retrieved
479
- */
480
- static NAN_METHOD(getString);
481
-
482
- /*
483
- Gets string data (JavaScript string type) associated with the given key from a database. You need to open a database in the environment to use this.
484
- This method is zero-copy and the return value can only be used until the next put operation or until the transaction is committed or aborted.
485
- (Wrapper for `mdb_get`)
486
-
487
- Parameters:
488
-
489
- * database instance created with calling `openDbi()` on an `Env` instance
490
- * key for which the value is retrieved
491
- */
492
- static NAN_METHOD(getStringUnsafe);
493
-
494
- /*
495
- Gets binary data (Node.js Buffer) associated with the given key from a database. You need to open a database in the environment to use this.
496
- This method is not zero-copy and the return value will usable as long as there is a reference to it.
497
- (Wrapper for `mdb_get`)
498
-
499
- Parameters:
500
-
501
- * database instance created with calling `openDbi()` on an `Env` instance
502
- * key for which the value is retrieved
503
- */
504
- static NAN_METHOD(getBinary);
505
-
506
- /*
507
- Gets binary data (Node.js Buffer) associated with the given key from a database. You need to open a database in the environment to use this.
508
- This method is zero-copy and the return value can only be used until the next put operation or until the transaction is committed or aborted.
509
- (Wrapper for `mdb_get`)
510
-
511
- Parameters:
512
-
513
- * database instance created with calling `openDbi()` on an `Env` instance
514
- * key for which the value is retrieved
515
- */
516
- static NAN_METHOD(getBinaryUnsafe);
517
-
518
- /*
519
- Gets number data (JavaScript number type) associated with the given key from a database. You need to open a database in the environment to use this.
520
- This method will copy the value out of the database.
521
- (Wrapper for `mdb_get`)
522
-
523
- Parameters:
524
-
525
- * database instance created with calling `openDbi()` on an `Env` instance
526
- * key for which the value is retrieved
527
- */
528
- static NAN_METHOD(getNumber);
529
-
530
- /*
531
- Gets boolean data (JavaScript boolean type) associated with the given key from a database. You need to open a database in the environment to use this.
532
- This method will copy the value out of the database.
533
- (Wrapper for `mdb_get`)
534
-
535
- Parameters:
536
-
537
- * database instance created with calling `openDbi()` on an `Env` instance
538
- * key for which the value is retrieved
539
- */
540
- static NAN_METHOD(getBoolean);
541
-
542
- /*
543
- Puts string data (JavaScript string type) into a database.
544
- (Wrapper for `mdb_put`)
545
-
546
- Parameters:
547
-
548
- * database instance created with calling `openDbi()` on an `Env` instance
549
- * key for which the value is stored
550
- * data to store for the given key
551
- */
552
- static NAN_METHOD(putString);
553
-
554
- /*
555
- Puts string data (JavaScript string type) into a database as UTF-8.
556
- (Wrapper for `mdb_put`)
557
-
558
- Parameters:
559
-
560
- * database instance created with calling `openDbi()` on an `Env` instance
561
- * key for which the value is stored
562
- * data to store for the given key
563
- */
564
- static NAN_METHOD(putUtf8);
565
-
566
- /*
567
- Puts binary data (Node.js Buffer) into a database.
568
- (Wrapper for `mdb_put`)
569
-
570
- Parameters:
571
-
572
- * database instance created with calling `openDbi()` on an `Env` instance
573
- * key for which the value is stored
574
- * data to store for the given key
575
- */
576
- static NAN_METHOD(putBinary);
577
-
578
- /*
579
- Puts number data (JavaScript number type) into a database.
580
- (Wrapper for `mdb_put`)
581
-
582
- Parameters:
583
-
584
- * database instance created with calling `openDbi()` on an `Env` instance
585
- * key for which the value is stored
586
- * data to store for the given key
587
- */
588
- static NAN_METHOD(putNumber);
589
-
590
- /*
591
- Puts boolean data (JavaScript boolean type) into a database.
592
- (Wrapper for `mdb_put`)
593
-
594
- Parameters:
595
-
596
- * database instance created with calling `openDbi()` on an `Env` instance
597
- * key for which the value is stored
598
- * data to store for the given key
599
- */
600
- static NAN_METHOD(putBoolean);
601
-
602
- /*
603
- Deletes data with the given key from the database.
604
- (Wrapper for `mdb_del`)
605
-
606
- * database instance created with calling `openDbi()` on an `Env` instance
607
- * key for which the value is stored
608
- */
609
- static NAN_METHOD(del);
610
- };
611
-
612
- /*
613
- `Dbi`
614
- Represents a database instance in an environment.
615
- (Wrapper for `MDB_dbi`)
616
- */
617
- class DbiWrap : public Nan::ObjectWrap {
618
- public:
619
- // Tells how keys should be treated
620
- NodeLmdbKeyType keyType;
621
- // Stores flags set when opened
622
- int flags;
623
- // The wrapped object
624
- MDB_dbi dbi;
625
- // Reference to the MDB_env of the wrapped MDB_dbi
626
- MDB_env *env;
627
- // The EnvWrap object of the current Dbi
628
- EnvWrap *ew;
629
- // Whether the Dbi was opened successfully
630
- bool isOpen;
631
- // compression settings and space
632
- Compression* compression;
633
- // versions stored in data
634
- bool hasVersions;
635
- // current unsafe buffer for this db
636
- char* lastUnsafePtr;
637
- void setUnsafeBuffer(char* unsafePtr, const Persistent<Object> &unsafeBuffer);
638
- void Get();
639
- static void GetSlow(const v8::FunctionCallbackInfo<v8::Value>& info);
640
-
641
- friend class TxnWrap;
642
- friend class CursorWrap;
643
- friend class EnvWrap;
644
-
645
- DbiWrap(MDB_env *env, MDB_dbi dbi);
646
- ~DbiWrap();
647
-
648
- // Constructor (not exposed)
649
- static NAN_METHOD(ctor);
650
-
651
- /*
652
- Closes the database instance.
653
- Wrapper for `mdb_dbi_close`)
654
- */
655
- static NAN_METHOD(close);
656
-
657
- /*
658
- Drops the database instance, either deleting it completely (default) or just freeing its pages.
659
-
660
- Parameters:
661
-
662
- * Options object that contains possible configuration options.
663
-
664
- Possible options are:
665
-
666
- * justFreePages - indicates that the database pages need to be freed but the database shouldn't be deleted
667
-
668
- */
669
- static NAN_METHOD(drop);
670
-
671
- static NAN_METHOD(stat);
672
- };
673
-
674
- class Compression : public Nan::ObjectWrap {
675
- public:
676
- char* dictionary;
677
- char* decompressBlock;
678
- char* decompressTarget;
679
- unsigned int decompressSize;
680
- unsigned int compressionThreshold;
681
- Persistent<Object> unsafeBuffer;
682
- // compression acceleration (defaults to 1)
683
- int acceleration;
684
- static thread_local LZ4_stream_t* stream;
685
- void decompress(MDB_val& data, bool &isValid);
686
- argtokey_callback_t compress(MDB_val* value, argtokey_callback_t freeValue);
687
- void makeUnsafeBuffer();
688
- void expand(unsigned int size);
689
- static NAN_METHOD(ctor);
690
- Compression();
691
- ~Compression();
692
- friend class EnvWrap;
693
- friend class DbiWrap;
694
- };
695
-
696
- /*
697
- `Cursor`
698
- Represents a cursor instance that is assigned to a transaction and a database instance
699
- (Wrapper for `MDB_cursor`)
700
- */
701
- class CursorWrap : public Nan::ObjectWrap {
702
-
703
- private:
704
-
705
- // The wrapped object
706
- MDB_cursor *cursor;
707
- // Stores how key is represented
708
- NodeLmdbKeyType keyType;
709
- // Key/data pair where the cursor is at
710
- MDB_val key, data;
711
- // Free function for the current key
712
- argtokey_callback_t freeKey;
713
-
714
- DbiWrap *dw;
715
- TxnWrap *tw;
716
-
717
- template<size_t keyIndex, size_t optionsIndex>
718
- friend argtokey_callback_t cursorArgToKey(CursorWrap* cw, Nan::NAN_METHOD_ARGS_TYPE info, MDB_val &key, bool &keyIsValid);
719
-
720
- public:
721
- CursorWrap(MDB_cursor *cursor);
722
- ~CursorWrap();
723
-
724
- // Sets up exports for the Cursor constructor
725
- static void setupExports(Local<Object> exports);
726
-
727
- /*
728
- Opens a new cursor for the specified transaction and database instance.
729
- (Wrapper for `mdb_cursor_open`)
730
-
731
- Parameters:
732
-
733
- * Transaction object
734
- * Database instance object
735
- */
736
- static NAN_METHOD(ctor);
737
-
738
- /*
739
- Closes the cursor.
740
- (Wrapper for `mdb_cursor_close`)
741
-
742
- Parameters:
743
-
744
- * Transaction object
745
- * Database instance object
746
- */
747
- static NAN_METHOD(close);
748
-
749
- // Helper method for getters (not exposed)
750
- static Nan::NAN_METHOD_RETURN_TYPE getCommon(
751
- Nan::NAN_METHOD_ARGS_TYPE info, MDB_cursor_op op,
752
- argtokey_callback_t (*setKey)(CursorWrap* cw, Nan::NAN_METHOD_ARGS_TYPE info, MDB_val&, bool&),
753
- void (*setData)(CursorWrap* cw, Nan::NAN_METHOD_ARGS_TYPE info, MDB_val&),
754
- void (*freeData)(CursorWrap* cw, Nan::NAN_METHOD_ARGS_TYPE info, MDB_val&),
755
- Local<Value> (*convertFunc)(MDB_val &data));
756
-
757
- // Helper method for getters (not exposed)
758
- static Nan::NAN_METHOD_RETURN_TYPE getCommon(Nan::NAN_METHOD_ARGS_TYPE info, MDB_cursor_op op);
759
-
760
- /*
761
- Gets the current key-data pair that the cursor is pointing to. Returns the current key.
762
- This method is not zero-copy and the return value will usable as long as there is a reference to it.
763
- (Wrapper for `mdb_cursor_get`)
764
-
765
- Parameters:
766
-
767
- * Callback that accepts the key and value
768
- */
769
- static NAN_METHOD(getCurrentUtf8);
770
-
771
- /*
772
- Gets the current key-data pair that the cursor is pointing to. Returns the current key.
773
- This method is not zero-copy and the return value will usable as long as there is a reference to it.
774
- (Wrapper for `mdb_cursor_get`)
775
-
776
- Parameters:
777
-
778
- * Callback that accepts the key and value
779
- */
780
- static NAN_METHOD(getCurrentString);
781
-
782
- /*
783
- Gets the current key-data pair that the cursor is pointing to. Returns the current key.
784
- This method is zero-copy and the value can only be used until the next put operation or until the transaction is committed or aborted.
785
- (Wrapper for `mdb_cursor_get`)
786
-
787
- Parameters:
788
-
789
- * Callback that accepts the key and value
790
- */
791
- static NAN_METHOD(getCurrentStringUnsafe);
792
-
793
- /*
794
- Gets the current key-data pair that the cursor is pointing to. Returns the current key.
795
- (Wrapper for `mdb_cursor_get`)
796
-
797
- Parameters:
798
-
799
- * Callback that accepts the key and value
800
- */
801
- static NAN_METHOD(getCurrentBinary);
802
-
803
-
804
- /*
805
- Gets the current key-data pair with zero-copy that the cursor is pointing to. Returns the current key.
806
- This method is zero-copy and the value can only be used until the next put operation or until the transaction is committed or aborted.
807
- (Wrapper for `mdb_cursor_get`)
808
-
809
- Parameters:
810
-
811
- * Callback that accepts the key and value
812
- */
813
- static NAN_METHOD(getCurrentBinaryUnsafe);
814
-
815
- /*
816
- Gets the current key-data pair that the cursor is pointing to. Returns the current key.
817
- (Wrapper for `mdb_cursor_get`)
818
-
819
- Parameters:
820
-
821
- * Callback that accepts the key and value
822
- */
823
- static NAN_METHOD(getCurrentNumber);
824
-
825
- /*
826
- Gets the current key-data pair that the cursor is pointing to.
827
- (Wrapper for `mdb_cursor_get`)
828
-
829
- Parameters:
830
-
831
- * Callback that accepts the key and value
832
- */
833
- static NAN_METHOD(getCurrentBoolean);
834
-
835
- /*
836
- Is the current cursor a database
837
- (Wrapper for `mdb_cursor_is_db`)
838
- */
839
- static NAN_METHOD(getCurrentIsDatabase);
840
-
841
- /*
842
- Asks the cursor to go to the first key-data pair in the database.
843
- (Wrapper for `mdb_cursor_get`)
844
- */
845
- static NAN_METHOD(goToFirst);
846
-
847
- /*
848
- Asks the cursor to go to the last key-data pair in the database.
849
- (Wrapper for `mdb_cursor_get`)
850
- */
851
- static NAN_METHOD(goToLast);
852
-
853
- /*
854
- Asks the cursor to go to the next key-data pair in the database.
855
- (Wrapper for `mdb_cursor_get`)
856
- */
857
- static NAN_METHOD(goToNext);
858
-
859
- /*
860
- Asks the cursor to go to the previous key-data pair in the database.
861
- (Wrapper for `mdb_cursor_get`)
862
- */
863
- static NAN_METHOD(goToPrev);
864
-
865
- /*
866
- Asks the cursor to go to the specified key in the database.
867
- (Wrapper for `mdb_cursor_get`)
868
- */
869
- static NAN_METHOD(goToKey);
870
-
871
- /*
872
- Asks the cursor to go to the first key greater than or equal to the specified parameter in the database.
873
- (Wrapper for `mdb_cursor_get`)
874
- */
875
- static NAN_METHOD(goToRange);
876
-
877
- /*
878
- For databases with the dupSort option. Asks the cursor to go to the first occurence of the current key.
879
- (Wrapper for `mdb_cursor_get`)
880
- */
881
- static NAN_METHOD(goToFirstDup);
882
-
883
- /*
884
- For databases with the dupSort option. Asks the cursor to go to the last occurence of the current key.
885
- (Wrapper for `mdb_cursor_get`)
886
- */
887
- static NAN_METHOD(goToLastDup);
888
-
889
- /*
890
- For databases with the dupSort option. Asks the cursor to go to the next occurence of the current key.
891
- (Wrapper for `mdb_cursor_get`)
892
- */
893
- static NAN_METHOD(goToNextDup);
894
-
895
- /*
896
- For databases with the dupSort option. Asks the cursor to go to the previous occurence of the current key.
897
- (Wrapper for `mdb_cursor_get`)
898
- */
899
- static NAN_METHOD(goToPrevDup);
900
-
901
- /*
902
- Go to the entry for next key.
903
- (Wrapper for `mdb_cursor_get`)
904
- */
905
- static NAN_METHOD(goToNextNoDup);
906
-
907
- /*
908
- Go to the entry for previous key.
909
- (Wrapper for `mdb_cursor_get`)
910
- */
911
- static NAN_METHOD(goToPrevNoDup);
912
-
913
- /*
914
- For databases with the dupSort option. Asks the cursor to go to the specified key/data pair.
915
- (Wrapper for `mdb_cursor_get`)
916
- */
917
- static NAN_METHOD(goToDup);
918
-
919
- /*
920
- For databases with the dupSort option. Asks the cursor to go to the specified key with the first data that is greater than or equal to the specified.
921
- (Wrapper for `mdb_cursor_get`)
922
- */
923
- static NAN_METHOD(goToDupRange);
924
-
925
- /*
926
- Deletes the key/data pair to which the cursor refers.
927
- (Wrapper for `mdb_cursor_del`)
928
- */
929
- static NAN_METHOD(del);
930
- };
931
-
932
- // External string resource that glues MDB_val and v8::String
933
- class CustomExternalStringResource : public String::ExternalStringResource {
934
- private:
935
- const uint16_t *d;
936
- size_t l;
937
-
938
- public:
939
- CustomExternalStringResource(MDB_val *val);
940
- ~CustomExternalStringResource();
941
-
942
- void Dispose();
943
- const uint16_t *data() const;
944
- size_t length() const;
945
-
946
- static void writeTo(Local<String> str, MDB_val *val);
947
- };
948
-
949
- class CustomExternalOneByteStringResource : public String::ExternalOneByteStringResource {
950
- private:
951
- const char *d;
952
- size_t l;
953
-
954
- public:
955
- CustomExternalOneByteStringResource(MDB_val *val);
956
- ~CustomExternalOneByteStringResource();
957
-
958
- void Dispose();
959
- const char *data() const;
960
- size_t length() const;
961
-
962
- };
963
-
964
-
965
- #endif // NODE_LMDB_H
1
+
2
+ // This file is part of lmdb-store
3
+ // Copyright (c) 2013-2017 Timur Kristóf
4
+ // Licensed to you under the terms of the MIT license
5
+ //
6
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ // of this software and associated documentation files (the "Software"), to deal
8
+ // in the Software without restriction, including without limitation the rights
9
+ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ // copies of the Software, and to permit persons to whom the Software is
11
+ // furnished to do so, subject to the following conditions:
12
+
13
+ // The above copyright notice and this permission notice shall be included in
14
+ // all copies or substantial portions of the Software.
15
+
16
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
+ // THE SOFTWARE.
23
+
24
+ #ifndef NODE_LMDB_H
25
+ #define NODE_LMDB_H
26
+
27
+ #include <vector>
28
+ #include <algorithm>
29
+ #include <v8.h>
30
+ #include <node.h>
31
+ #include <node_buffer.h>
32
+ #include <nan.h>
33
+ #include <uv.h>
34
+ #include "lmdb.h"
35
+ #include "chacha8.h"
36
+ #include "lz4.h"
37
+
38
+ using namespace v8;
39
+ using namespace node;
40
+
41
+ enum class NodeLmdbKeyType {
42
+
43
+ // Invalid key (used internally by node-lmdb)
44
+ InvalidKey = -1,
45
+
46
+ // Default key (used internally by node-lmdb)
47
+ DefaultKey = 0,
48
+
49
+ // UCS-2/UTF-16 with zero terminator - Appears to V8 as string
50
+ StringKey = 1,
51
+
52
+ // LMDB fixed size integer key with 32 bit keys - Appearts to V8 as an Uint32
53
+ Uint32Key = 2,
54
+
55
+ // LMDB default key format - Appears to V8 as node::Buffer
56
+ BinaryKey = 3,
57
+
58
+ };
59
+ enum class KeyCreation {
60
+ Reset = 0,
61
+ Continue = 1,
62
+ InArray = 2,
63
+ };
64
+
65
+ class TxnWrap;
66
+ class DbiWrap;
67
+ class EnvWrap;
68
+ class CursorWrap;
69
+ class Compression;
70
+ class KeySpace;
71
+
72
+ // Exports misc stuff to the module
73
+ void setupExportMisc(Local<Object> exports);
74
+
75
+ // Helper callback
76
+ typedef void (*argtokey_callback_t)(MDB_val &key);
77
+
78
+ void consoleLog(Local<Value> val);
79
+ void consoleLog(const char *msg);
80
+ void consoleLogN(int n);
81
+ void setFlagFromValue(int *flags, int flag, const char *name, bool defaultValue, Local<Object> options);
82
+ #ifdef _WIN32
83
+ extern "C" {
84
+ int setProcessMemoryPriority(int priority);
85
+ int lowerMemoryPriority(int priority);
86
+ int restoreMemoryPriority();
87
+ }
88
+ #define lowerMemPriority(ew) if (ew->winMemoryPriority < 5) lowerMemoryPriority(ew->winMemoryPriority)
89
+ #define restoreMemPriority(ew) if (ew->winMemoryPriority < 5) restoreMemoryPriority()
90
+ #else
91
+ #define lowerMemPriority(ew)
92
+ #define restoreMemPriority(ew)
93
+ #endif
94
+ void writeValueToEntry(const Local<Value> &str, MDB_val *val);
95
+ argtokey_callback_t argToKey(const Local<Value> &val, MDB_val &key, NodeLmdbKeyType keyType, bool &isValid);
96
+ bool valueToMDBKey(const Local<Value> &key, MDB_val &val, KeySpace &keySpace);
97
+
98
+ NodeLmdbKeyType inferAndValidateKeyType(const Local<Value> &key, const Local<Value> &options, NodeLmdbKeyType dbiKeyType, bool &isValid);
99
+ NodeLmdbKeyType inferKeyType(const Local<Value> &val);
100
+ NodeLmdbKeyType keyTypeFromOptions(const Local<Value> &val, NodeLmdbKeyType defaultKeyType = NodeLmdbKeyType::DefaultKey);
101
+ Local<Value> keyToHandle(MDB_val &key, NodeLmdbKeyType keyType);
102
+ Local<Value> getVersionAndUncompress(MDB_val &data, DbiWrap* dw, Local<Value> (*successFunc)(MDB_val&));
103
+ NAN_METHOD(getLastVersion);
104
+ NAN_METHOD(setLastVersion);
105
+ NAN_METHOD(setWinMemoryLimit);
106
+ NAN_METHOD(setWinMemoryPriority);
107
+ NAN_METHOD(bufferToKeyValue);
108
+ NAN_METHOD(keyValueToBuffer);
109
+
110
+ class KeySpaceHolder {
111
+ public:
112
+ uint8_t* data;
113
+ KeySpaceHolder* previousSpace;
114
+ KeySpaceHolder(KeySpaceHolder* existingPreviousSpace, uint8_t* existingData);
115
+ KeySpaceHolder();
116
+ ~KeySpaceHolder();
117
+ };
118
+ class KeySpace : public KeySpaceHolder {
119
+ public:
120
+ int position;
121
+ int size;
122
+ bool fixedSize;
123
+ uint8_t* getTarget();
124
+ KeySpace(bool fixed);
125
+ };
126
+
127
+ #ifndef thread_local
128
+ #ifdef __GNUC__
129
+ # define thread_local __thread
130
+ #elif __STDC_VERSION__ >= 201112L
131
+ # define thread_local _Thread_local
132
+ #elif defined(_MSC_VER)
133
+ # define thread_local __declspec(thread)
134
+ #else
135
+ # define thread_local
136
+ #endif
137
+ #endif
138
+
139
+ // markers for special cases
140
+ const double ANY_VERSION = -3.3434325325532E-199;
141
+ const double NO_EXIST_VERSION = -4.2434325325532E-199;
142
+
143
+ static thread_local double lastVersion = 0;
144
+ static thread_local DbiWrap* currentDb = nullptr;
145
+ static thread_local KeySpace* fixedKeySpace;
146
+ KeySpace* getFixedKeySpace();
147
+ void setLastVersion(double version);
148
+
149
+ Local<Value> valToUtf8(MDB_val &data);
150
+ Local<Value> valToString(MDB_val &data);
151
+ Local<Value> valToStringUnsafe(MDB_val &data);
152
+ Local<Value> valToBinary(MDB_val &data);
153
+ Local<Value> valToBinaryUnsafe(MDB_val &data);
154
+ Local<Value> valToNumber(MDB_val &data);
155
+ Local<Value> valToBoolean(MDB_val &data);
156
+
157
+ Local<Value> MDBKeyToValue(MDB_val &data);
158
+ void makeGlobalUnsafeBuffer(size_t size);
159
+
160
+ int putWithVersion(MDB_txn * txn,
161
+ MDB_dbi dbi,
162
+ MDB_val * key,
163
+ MDB_val * data,
164
+ unsigned int flags, double version);
165
+
166
+ void throwLmdbError(int rc);
167
+
168
+ class TxnWrap;
169
+ class DbiWrap;
170
+ class EnvWrap;
171
+ class CursorWrap;
172
+ struct env_path_t {
173
+ MDB_env* env;
174
+ char* path;
175
+ int count;
176
+ };
177
+
178
+ struct action_t {
179
+ int actionType;
180
+ MDB_val key;
181
+ union {
182
+ struct {
183
+ DbiWrap* dw;
184
+ };
185
+ struct {
186
+ MDB_val data;
187
+ double ifVersion;
188
+ double version;
189
+ argtokey_callback_t freeValue;
190
+ };
191
+ };
192
+ };
193
+
194
+ const int INTERRUPT_BATCH = 9998;
195
+ const int RESUME_BATCH = 9999;
196
+
197
+ class BatchWorkerBase : public Nan::AsyncProgressWorker {
198
+ public:
199
+ BatchWorkerBase(Nan::Callback *callback, EnvWrap* envForTxn);
200
+ void ContinueBatch(int rc, bool hasStarted);
201
+ uv_mutex_t* userCallbackLock;
202
+ uv_cond_t* userCallbackCond;
203
+ int interruptionStatus;
204
+ bool finishedProgress;
205
+ EnvWrap* envForTxn;
206
+ TxnWrap* currentTxnWrap;
207
+ ~BatchWorkerBase();
208
+ };
209
+
210
+ /*
211
+ `Env`
212
+ Represents a database environment.
213
+ (Wrapper for `MDB_env`)
214
+ */
215
+ class EnvWrap : public Nan::ObjectWrap {
216
+ private:
217
+ // List of open read transactions
218
+ std::vector<TxnWrap*> readTxns;
219
+ // Constructor for TxnWrap
220
+ static thread_local Nan::Persistent<Function>* txnCtor;
221
+ // Constructor for DbiWrap
222
+ static thread_local Nan::Persistent<Function>* dbiCtor;
223
+ static uv_mutex_t* envsLock;
224
+ static std::vector<env_path_t> envs;
225
+ static uv_mutex_t* initMutex();
226
+ // compression settings and space
227
+ Compression *compression;
228
+ BatchWorkerBase* batchWorker;
229
+
230
+ // Cleans up stray transactions
231
+ void cleanupStrayTxns();
232
+
233
+ friend class TxnWrap;
234
+ friend class DbiWrap;
235
+
236
+ public:
237
+ EnvWrap();
238
+ ~EnvWrap();
239
+ // The wrapped object
240
+ MDB_env *env;
241
+ // Current write transaction
242
+ TxnWrap *currentWriteTxn;
243
+
244
+ MDB_txn* currentReadTxn;
245
+ bool readTxnRenewed;
246
+ // Current raw batch transaction
247
+ MDB_txn *currentBatchTxn;
248
+ // What memory priority for accessing LMDB data in windows
249
+ int winMemoryPriority;
250
+ char* syncInstructions;
251
+ Nan::Persistent<Function> onReadTxnRenew;
252
+ MDB_txn* getReadTxn();
253
+
254
+ // Sets up exports for the Env constructor
255
+ static void setupExports(Local<Object> exports);
256
+
257
+ /*
258
+ Constructor of the database environment. You need to `open()` it before you can use it.
259
+ (Wrapper for `mdb_env_create`)
260
+ */
261
+ static NAN_METHOD(ctor);
262
+
263
+ /*
264
+ Gets statistics about the database environment.
265
+ */
266
+ static NAN_METHOD(stat);
267
+
268
+ /*
269
+ Gets statistics about the free space database
270
+ */
271
+ static NAN_METHOD(freeStat);
272
+
273
+ /*
274
+ Detaches a buffer from the backing store
275
+ */
276
+ static NAN_METHOD(detachBuffer);
277
+
278
+ /*
279
+ Gets information about the database environment.
280
+ */
281
+ static NAN_METHOD(info);
282
+ /*
283
+ Check for stale readers
284
+ */
285
+ static NAN_METHOD(readerCheck);
286
+ /*
287
+ Print a list of readers
288
+ */
289
+ static NAN_METHOD(readerList);
290
+
291
+ /*
292
+ Opens the database environment with the specified options. The options will be used to configure the environment before opening it.
293
+ (Wrapper for `mdb_env_open`)
294
+
295
+ Parameters:
296
+
297
+ * Options object that contains possible configuration options.
298
+
299
+ Possible options are:
300
+
301
+ * maxDbs: the maximum number of named databases you can have in the environment (default is 1)
302
+ * maxReaders: the maximum number of concurrent readers of the environment (default is 126)
303
+ * mapSize: maximal size of the memory map (the full environment) in bytes (default is 10485760 bytes)
304
+ * path: path to the database environment
305
+ */
306
+ static NAN_METHOD(open);
307
+
308
+ /*
309
+ Resizes the maximal size of the memory map. It may be called if no transactions are active in this process.
310
+ (Wrapper for `mdb_env_set_mapsize`)
311
+
312
+ Parameters:
313
+
314
+ * maximal size of the memory map (the full environment) in bytes (default is 10485760 bytes)
315
+ */
316
+ static NAN_METHOD(resize);
317
+
318
+ /*
319
+ Copies the database environment to a file.
320
+ (Wrapper for `mdb_env_copy2`)
321
+
322
+ Parameters:
323
+
324
+ * path - Path to the target file
325
+ * compact (optional) - Copy using compact setting
326
+ * callback - Callback when finished (this is performed asynchronously)
327
+ */
328
+ static NAN_METHOD(copy);
329
+
330
+ /*
331
+ Closes the database environment.
332
+ (Wrapper for `mdb_env_close`)
333
+ */
334
+ static NAN_METHOD(close);
335
+
336
+ /*
337
+ Starts a new transaction in the environment.
338
+ (Wrapper for `mdb_txn_begin`)
339
+
340
+ Parameters:
341
+
342
+ * Options object that contains possible configuration options.
343
+
344
+ Possible options are:
345
+
346
+ * readOnly: if true, the transaction is read-only
347
+ */
348
+ static NAN_METHOD(beginTxn);
349
+
350
+ /*
351
+ Opens a database in the environment.
352
+ (Wrapper for `mdb_dbi_open`)
353
+
354
+ Parameters:
355
+
356
+ * Options object that contains possible configuration options.
357
+
358
+ Possible options are:
359
+
360
+ * name: the name of the database (or null to use the unnamed database)
361
+ * create: if true, the database will be created if it doesn't exist
362
+ * keyIsUint32: if true, keys are treated as 32-bit unsigned integers
363
+ * dupSort: if true, the database can hold multiple items with the same key
364
+ * reverseKey: keys are strings to be compared in reverse order
365
+ * dupFixed: if dupSort is true, indicates that the data items are all the same size
366
+ * integerDup: duplicate data items are also integers, and should be sorted as such
367
+ * reverseDup: duplicate data items should be compared as strings in reverse order
368
+ */
369
+ static NAN_METHOD(openDbi);
370
+
371
+ /*
372
+ Flushes all data to the disk asynchronously.
373
+ (Asynchronous wrapper for `mdb_env_sync`)
374
+
375
+ Parameters:
376
+
377
+ * Callback to be executed after the sync is complete.
378
+ */
379
+ static NAN_METHOD(sync);
380
+
381
+ /*
382
+ Performs a set of operations asynchronously, automatically wrapping it in its own transaction
383
+
384
+ Parameters:
385
+
386
+ * Callback to be executed after the sync is complete.
387
+ */
388
+ static NAN_METHOD(batchWrite);
389
+
390
+ static NAN_METHOD(continueBatch);
391
+ static NAN_METHOD(resetCurrentReadTxn);
392
+ };
393
+
394
+ /*
395
+ `Txn`
396
+ Represents a transaction running on a database environment.
397
+ (Wrapper for `MDB_txn`)
398
+ */
399
+ class TxnWrap : public Nan::ObjectWrap {
400
+ private:
401
+
402
+ // Reference to the MDB_env of the wrapped MDB_txn
403
+ MDB_env *env;
404
+
405
+ // Environment wrapper of the current transaction
406
+ EnvWrap *ew;
407
+ // parent TW, if it is exists
408
+ TxnWrap *parentTw;
409
+ // The wrapped object
410
+ MDB_txn *txn;
411
+
412
+ // Flags used with mdb_txn_begin
413
+ unsigned int flags;
414
+
415
+ friend class CursorWrap;
416
+ friend class DbiWrap;
417
+ friend class EnvWrap;
418
+
419
+ public:
420
+ TxnWrap(MDB_env *env, MDB_txn *txn);
421
+ ~TxnWrap();
422
+ // Remove the current TxnWrap from its EnvWrap
423
+ void removeFromEnvWrap();
424
+
425
+ // Constructor (not exposed)
426
+ static NAN_METHOD(ctor);
427
+
428
+ // Helper for all the get methods (not exposed)
429
+ static Nan::NAN_METHOD_RETURN_TYPE getCommon(Nan::NAN_METHOD_ARGS_TYPE info, Local<Value> (*successFunc)(MDB_val&));
430
+
431
+ // Helper for all the put methods (not exposed)
432
+ static Nan::NAN_METHOD_RETURN_TYPE putCommon(Nan::NAN_METHOD_ARGS_TYPE info, void (*fillFunc)(Nan::NAN_METHOD_ARGS_TYPE info, MDB_val&), void (*freeFunc)(MDB_val&));
433
+
434
+ /*
435
+ Commits the transaction.
436
+ (Wrapper for `mdb_txn_commit`)
437
+ */
438
+ static NAN_METHOD(commit);
439
+
440
+ /*
441
+ Aborts the transaction.
442
+ (Wrapper for `mdb_txn_abort`)
443
+ */
444
+ static NAN_METHOD(abort);
445
+
446
+ /*
447
+ Aborts a read-only transaction but makes it renewable with `renew`.
448
+ (Wrapper for `mdb_txn_reset`)
449
+ */
450
+ static NAN_METHOD(reset);
451
+
452
+ /*
453
+ Renews a read-only transaction after it has been reset.
454
+ (Wrapper for `mdb_txn_renew`)
455
+ */
456
+ static NAN_METHOD(renew);
457
+
458
+ /*
459
+ Gets string data (JavaScript string type) associated with the given key from a database as UTF-8. You need to open a database in the environment to use this.
460
+ This method is not zero-copy and the return value will usable as long as there is a reference to it.
461
+ (Wrapper for `mdb_get`)
462
+
463
+ Parameters:
464
+
465
+ * database instance created with calling `openDbi()` on an `Env` instance
466
+ * key for which the value is retrieved
467
+ */
468
+ static NAN_METHOD(getUtf8);
469
+
470
+ /*
471
+ Gets string data (JavaScript string type) associated with the given key from a database. You need to open a database in the environment to use this.
472
+ This method is not zero-copy and the return value will usable as long as there is a reference to it.
473
+ (Wrapper for `mdb_get`)
474
+
475
+ Parameters:
476
+
477
+ * database instance created with calling `openDbi()` on an `Env` instance
478
+ * key for which the value is retrieved
479
+ */
480
+ static NAN_METHOD(getString);
481
+
482
+ /*
483
+ Gets string data (JavaScript string type) associated with the given key from a database. You need to open a database in the environment to use this.
484
+ This method is zero-copy and the return value can only be used until the next put operation or until the transaction is committed or aborted.
485
+ (Wrapper for `mdb_get`)
486
+
487
+ Parameters:
488
+
489
+ * database instance created with calling `openDbi()` on an `Env` instance
490
+ * key for which the value is retrieved
491
+ */
492
+ static NAN_METHOD(getStringUnsafe);
493
+
494
+ /*
495
+ Gets binary data (Node.js Buffer) associated with the given key from a database. You need to open a database in the environment to use this.
496
+ This method is not zero-copy and the return value will usable as long as there is a reference to it.
497
+ (Wrapper for `mdb_get`)
498
+
499
+ Parameters:
500
+
501
+ * database instance created with calling `openDbi()` on an `Env` instance
502
+ * key for which the value is retrieved
503
+ */
504
+ static NAN_METHOD(getBinary);
505
+
506
+ /*
507
+ Gets binary data (Node.js Buffer) associated with the given key from a database. You need to open a database in the environment to use this.
508
+ This method is zero-copy and the return value can only be used until the next put operation or until the transaction is committed or aborted.
509
+ (Wrapper for `mdb_get`)
510
+
511
+ Parameters:
512
+
513
+ * database instance created with calling `openDbi()` on an `Env` instance
514
+ * key for which the value is retrieved
515
+ */
516
+ static NAN_METHOD(getBinaryUnsafe);
517
+
518
+ /*
519
+ Gets number data (JavaScript number type) associated with the given key from a database. You need to open a database in the environment to use this.
520
+ This method will copy the value out of the database.
521
+ (Wrapper for `mdb_get`)
522
+
523
+ Parameters:
524
+
525
+ * database instance created with calling `openDbi()` on an `Env` instance
526
+ * key for which the value is retrieved
527
+ */
528
+ static NAN_METHOD(getNumber);
529
+
530
+ /*
531
+ Gets boolean data (JavaScript boolean type) associated with the given key from a database. You need to open a database in the environment to use this.
532
+ This method will copy the value out of the database.
533
+ (Wrapper for `mdb_get`)
534
+
535
+ Parameters:
536
+
537
+ * database instance created with calling `openDbi()` on an `Env` instance
538
+ * key for which the value is retrieved
539
+ */
540
+ static NAN_METHOD(getBoolean);
541
+
542
+ /*
543
+ Puts string data (JavaScript string type) into a database.
544
+ (Wrapper for `mdb_put`)
545
+
546
+ Parameters:
547
+
548
+ * database instance created with calling `openDbi()` on an `Env` instance
549
+ * key for which the value is stored
550
+ * data to store for the given key
551
+ */
552
+ static NAN_METHOD(putString);
553
+
554
+ /*
555
+ Puts string data (JavaScript string type) into a database as UTF-8.
556
+ (Wrapper for `mdb_put`)
557
+
558
+ Parameters:
559
+
560
+ * database instance created with calling `openDbi()` on an `Env` instance
561
+ * key for which the value is stored
562
+ * data to store for the given key
563
+ */
564
+ static NAN_METHOD(putUtf8);
565
+
566
+ /*
567
+ Puts binary data (Node.js Buffer) into a database.
568
+ (Wrapper for `mdb_put`)
569
+
570
+ Parameters:
571
+
572
+ * database instance created with calling `openDbi()` on an `Env` instance
573
+ * key for which the value is stored
574
+ * data to store for the given key
575
+ */
576
+ static NAN_METHOD(putBinary);
577
+
578
+ /*
579
+ Puts number data (JavaScript number type) into a database.
580
+ (Wrapper for `mdb_put`)
581
+
582
+ Parameters:
583
+
584
+ * database instance created with calling `openDbi()` on an `Env` instance
585
+ * key for which the value is stored
586
+ * data to store for the given key
587
+ */
588
+ static NAN_METHOD(putNumber);
589
+
590
+ /*
591
+ Puts boolean data (JavaScript boolean type) into a database.
592
+ (Wrapper for `mdb_put`)
593
+
594
+ Parameters:
595
+
596
+ * database instance created with calling `openDbi()` on an `Env` instance
597
+ * key for which the value is stored
598
+ * data to store for the given key
599
+ */
600
+ static NAN_METHOD(putBoolean);
601
+
602
+ /*
603
+ Deletes data with the given key from the database.
604
+ (Wrapper for `mdb_del`)
605
+
606
+ * database instance created with calling `openDbi()` on an `Env` instance
607
+ * key for which the value is stored
608
+ */
609
+ static NAN_METHOD(del);
610
+ };
611
+
612
+ /*
613
+ `Dbi`
614
+ Represents a database instance in an environment.
615
+ (Wrapper for `MDB_dbi`)
616
+ */
617
+ class DbiWrap : public Nan::ObjectWrap {
618
+ public:
619
+ // Tells how keys should be treated
620
+ NodeLmdbKeyType keyType;
621
+ // Stores flags set when opened
622
+ int flags;
623
+ // The wrapped object
624
+ MDB_dbi dbi;
625
+ // Reference to the MDB_env of the wrapped MDB_dbi
626
+ MDB_env *env;
627
+ // The EnvWrap object of the current Dbi
628
+ EnvWrap *ew;
629
+ // Whether the Dbi was opened successfully
630
+ bool isOpen;
631
+ // compression settings and space
632
+ Compression* compression;
633
+ // versions stored in data
634
+ bool hasVersions;
635
+ // current unsafe buffer for this db
636
+ char* lastUnsafePtr;
637
+ void setUnsafeBuffer(char* unsafePtr, const Persistent<Object> &unsafeBuffer);
638
+ void Get();
639
+ static void GetSlow(const v8::FunctionCallbackInfo<v8::Value>& info);
640
+
641
+ friend class TxnWrap;
642
+ friend class CursorWrap;
643
+ friend class EnvWrap;
644
+
645
+ DbiWrap(MDB_env *env, MDB_dbi dbi);
646
+ ~DbiWrap();
647
+
648
+ // Constructor (not exposed)
649
+ static NAN_METHOD(ctor);
650
+
651
+ /*
652
+ Closes the database instance.
653
+ Wrapper for `mdb_dbi_close`)
654
+ */
655
+ static NAN_METHOD(close);
656
+
657
+ /*
658
+ Drops the database instance, either deleting it completely (default) or just freeing its pages.
659
+
660
+ Parameters:
661
+
662
+ * Options object that contains possible configuration options.
663
+
664
+ Possible options are:
665
+
666
+ * justFreePages - indicates that the database pages need to be freed but the database shouldn't be deleted
667
+
668
+ */
669
+ static NAN_METHOD(drop);
670
+
671
+ static NAN_METHOD(stat);
672
+ };
673
+
674
+ class Compression : public Nan::ObjectWrap {
675
+ public:
676
+ char* dictionary;
677
+ char* decompressBlock;
678
+ char* decompressTarget;
679
+ unsigned int decompressSize;
680
+ unsigned int compressionThreshold;
681
+ Persistent<Object> unsafeBuffer;
682
+ // compression acceleration (defaults to 1)
683
+ int acceleration;
684
+ static thread_local LZ4_stream_t* stream;
685
+ void decompress(MDB_val& data, bool &isValid);
686
+ argtokey_callback_t compress(MDB_val* value, argtokey_callback_t freeValue);
687
+ void makeUnsafeBuffer();
688
+ void expand(unsigned int size);
689
+ static NAN_METHOD(ctor);
690
+ Compression();
691
+ ~Compression();
692
+ friend class EnvWrap;
693
+ friend class DbiWrap;
694
+ };
695
+
696
+ /*
697
+ `Cursor`
698
+ Represents a cursor instance that is assigned to a transaction and a database instance
699
+ (Wrapper for `MDB_cursor`)
700
+ */
701
+ class CursorWrap : public Nan::ObjectWrap {
702
+
703
+ private:
704
+
705
+ // The wrapped object
706
+ MDB_cursor *cursor;
707
+ // Stores how key is represented
708
+ NodeLmdbKeyType keyType;
709
+ // Key/data pair where the cursor is at
710
+ MDB_val key, data;
711
+ // Free function for the current key
712
+ argtokey_callback_t freeKey;
713
+
714
+ DbiWrap *dw;
715
+ TxnWrap *tw;
716
+
717
+ template<size_t keyIndex, size_t optionsIndex>
718
+ friend argtokey_callback_t cursorArgToKey(CursorWrap* cw, Nan::NAN_METHOD_ARGS_TYPE info, MDB_val &key, bool &keyIsValid);
719
+
720
+ public:
721
+ CursorWrap(MDB_cursor *cursor);
722
+ ~CursorWrap();
723
+
724
+ // Sets up exports for the Cursor constructor
725
+ static void setupExports(Local<Object> exports);
726
+
727
+ /*
728
+ Opens a new cursor for the specified transaction and database instance.
729
+ (Wrapper for `mdb_cursor_open`)
730
+
731
+ Parameters:
732
+
733
+ * Transaction object
734
+ * Database instance object
735
+ */
736
+ static NAN_METHOD(ctor);
737
+
738
+ /*
739
+ Closes the cursor.
740
+ (Wrapper for `mdb_cursor_close`)
741
+
742
+ Parameters:
743
+
744
+ * Transaction object
745
+ * Database instance object
746
+ */
747
+ static NAN_METHOD(close);
748
+
749
+ // Helper method for getters (not exposed)
750
+ static Nan::NAN_METHOD_RETURN_TYPE getCommon(
751
+ Nan::NAN_METHOD_ARGS_TYPE info, MDB_cursor_op op,
752
+ argtokey_callback_t (*setKey)(CursorWrap* cw, Nan::NAN_METHOD_ARGS_TYPE info, MDB_val&, bool&),
753
+ void (*setData)(CursorWrap* cw, Nan::NAN_METHOD_ARGS_TYPE info, MDB_val&),
754
+ void (*freeData)(CursorWrap* cw, Nan::NAN_METHOD_ARGS_TYPE info, MDB_val&),
755
+ Local<Value> (*convertFunc)(MDB_val &data));
756
+
757
+ // Helper method for getters (not exposed)
758
+ static Nan::NAN_METHOD_RETURN_TYPE getCommon(Nan::NAN_METHOD_ARGS_TYPE info, MDB_cursor_op op);
759
+
760
+ /*
761
+ Gets the current key-data pair that the cursor is pointing to. Returns the current key.
762
+ This method is not zero-copy and the return value will usable as long as there is a reference to it.
763
+ (Wrapper for `mdb_cursor_get`)
764
+
765
+ Parameters:
766
+
767
+ * Callback that accepts the key and value
768
+ */
769
+ static NAN_METHOD(getCurrentUtf8);
770
+
771
+ /*
772
+ Gets the current key-data pair that the cursor is pointing to. Returns the current key.
773
+ This method is not zero-copy and the return value will usable as long as there is a reference to it.
774
+ (Wrapper for `mdb_cursor_get`)
775
+
776
+ Parameters:
777
+
778
+ * Callback that accepts the key and value
779
+ */
780
+ static NAN_METHOD(getCurrentString);
781
+
782
+ /*
783
+ Gets the current key-data pair that the cursor is pointing to. Returns the current key.
784
+ This method is zero-copy and the value can only be used until the next put operation or until the transaction is committed or aborted.
785
+ (Wrapper for `mdb_cursor_get`)
786
+
787
+ Parameters:
788
+
789
+ * Callback that accepts the key and value
790
+ */
791
+ static NAN_METHOD(getCurrentStringUnsafe);
792
+
793
+ /*
794
+ Gets the current key-data pair that the cursor is pointing to. Returns the current key.
795
+ (Wrapper for `mdb_cursor_get`)
796
+
797
+ Parameters:
798
+
799
+ * Callback that accepts the key and value
800
+ */
801
+ static NAN_METHOD(getCurrentBinary);
802
+
803
+
804
+ /*
805
+ Gets the current key-data pair with zero-copy that the cursor is pointing to. Returns the current key.
806
+ This method is zero-copy and the value can only be used until the next put operation or until the transaction is committed or aborted.
807
+ (Wrapper for `mdb_cursor_get`)
808
+
809
+ Parameters:
810
+
811
+ * Callback that accepts the key and value
812
+ */
813
+ static NAN_METHOD(getCurrentBinaryUnsafe);
814
+
815
+ /*
816
+ Gets the current key-data pair that the cursor is pointing to. Returns the current key.
817
+ (Wrapper for `mdb_cursor_get`)
818
+
819
+ Parameters:
820
+
821
+ * Callback that accepts the key and value
822
+ */
823
+ static NAN_METHOD(getCurrentNumber);
824
+
825
+ /*
826
+ Gets the current key-data pair that the cursor is pointing to.
827
+ (Wrapper for `mdb_cursor_get`)
828
+
829
+ Parameters:
830
+
831
+ * Callback that accepts the key and value
832
+ */
833
+ static NAN_METHOD(getCurrentBoolean);
834
+
835
+ /*
836
+ Is the current cursor a database
837
+ (Wrapper for `mdb_cursor_is_db`)
838
+ */
839
+ static NAN_METHOD(getCurrentIsDatabase);
840
+
841
+ /*
842
+ Asks the cursor to go to the first key-data pair in the database.
843
+ (Wrapper for `mdb_cursor_get`)
844
+ */
845
+ static NAN_METHOD(goToFirst);
846
+
847
+ /*
848
+ Asks the cursor to go to the last key-data pair in the database.
849
+ (Wrapper for `mdb_cursor_get`)
850
+ */
851
+ static NAN_METHOD(goToLast);
852
+
853
+ /*
854
+ Asks the cursor to go to the next key-data pair in the database.
855
+ (Wrapper for `mdb_cursor_get`)
856
+ */
857
+ static NAN_METHOD(goToNext);
858
+
859
+ /*
860
+ Asks the cursor to go to the previous key-data pair in the database.
861
+ (Wrapper for `mdb_cursor_get`)
862
+ */
863
+ static NAN_METHOD(goToPrev);
864
+
865
+ /*
866
+ Asks the cursor to go to the specified key in the database.
867
+ (Wrapper for `mdb_cursor_get`)
868
+ */
869
+ static NAN_METHOD(goToKey);
870
+
871
+ /*
872
+ Asks the cursor to go to the first key greater than or equal to the specified parameter in the database.
873
+ (Wrapper for `mdb_cursor_get`)
874
+ */
875
+ static NAN_METHOD(goToRange);
876
+
877
+ /*
878
+ For databases with the dupSort option. Asks the cursor to go to the first occurence of the current key.
879
+ (Wrapper for `mdb_cursor_get`)
880
+ */
881
+ static NAN_METHOD(goToFirstDup);
882
+
883
+ /*
884
+ For databases with the dupSort option. Asks the cursor to go to the last occurence of the current key.
885
+ (Wrapper for `mdb_cursor_get`)
886
+ */
887
+ static NAN_METHOD(goToLastDup);
888
+
889
+ /*
890
+ For databases with the dupSort option. Asks the cursor to go to the next occurence of the current key.
891
+ (Wrapper for `mdb_cursor_get`)
892
+ */
893
+ static NAN_METHOD(goToNextDup);
894
+
895
+ /*
896
+ For databases with the dupSort option. Asks the cursor to go to the previous occurence of the current key.
897
+ (Wrapper for `mdb_cursor_get`)
898
+ */
899
+ static NAN_METHOD(goToPrevDup);
900
+
901
+ /*
902
+ Go to the entry for next key.
903
+ (Wrapper for `mdb_cursor_get`)
904
+ */
905
+ static NAN_METHOD(goToNextNoDup);
906
+
907
+ /*
908
+ Go to the entry for previous key.
909
+ (Wrapper for `mdb_cursor_get`)
910
+ */
911
+ static NAN_METHOD(goToPrevNoDup);
912
+
913
+ /*
914
+ For databases with the dupSort option. Asks the cursor to go to the specified key/data pair.
915
+ (Wrapper for `mdb_cursor_get`)
916
+ */
917
+ static NAN_METHOD(goToDup);
918
+
919
+ /*
920
+ For databases with the dupSort option. Asks the cursor to go to the specified key with the first data that is greater than or equal to the specified.
921
+ (Wrapper for `mdb_cursor_get`)
922
+ */
923
+ static NAN_METHOD(goToDupRange);
924
+
925
+ /*
926
+ Deletes the key/data pair to which the cursor refers.
927
+ (Wrapper for `mdb_cursor_del`)
928
+ */
929
+ static NAN_METHOD(del);
930
+ };
931
+
932
+ // External string resource that glues MDB_val and v8::String
933
+ class CustomExternalStringResource : public String::ExternalStringResource {
934
+ private:
935
+ const uint16_t *d;
936
+ size_t l;
937
+
938
+ public:
939
+ CustomExternalStringResource(MDB_val *val);
940
+ ~CustomExternalStringResource();
941
+
942
+ void Dispose();
943
+ const uint16_t *data() const;
944
+ size_t length() const;
945
+
946
+ static void writeTo(Local<String> str, MDB_val *val);
947
+ };
948
+
949
+ class CustomExternalOneByteStringResource : public String::ExternalOneByteStringResource {
950
+ private:
951
+ const char *d;
952
+ size_t l;
953
+
954
+ public:
955
+ CustomExternalOneByteStringResource(MDB_val *val);
956
+ ~CustomExternalOneByteStringResource();
957
+
958
+ void Dispose();
959
+ const char *data() const;
960
+ size_t length() const;
961
+
962
+ };
963
+
964
+
965
+ #endif // NODE_LMDB_H