@ohos-ports/lmdb 2.8.6-beta.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 (125) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +580 -0
  3. package/SECURITY.md +12 -0
  4. package/bin/download-prebuilds.js +15 -0
  5. package/binding.gyp +113 -0
  6. package/build/Release/lmdb.node +0 -0
  7. package/caching.js +212 -0
  8. package/dependencies/lmdb/libraries/liblmdb/COPYRIGHT +20 -0
  9. package/dependencies/lmdb/libraries/liblmdb/Doxyfile +1631 -0
  10. package/dependencies/lmdb/libraries/liblmdb/LICENSE +47 -0
  11. package/dependencies/lmdb/libraries/liblmdb/Makefile +136 -0
  12. package/dependencies/lmdb/libraries/liblmdb/chacha8.c +183 -0
  13. package/dependencies/lmdb/libraries/liblmdb/chacha8.h +14 -0
  14. package/dependencies/lmdb/libraries/liblmdb/crypto.c +121 -0
  15. package/dependencies/lmdb/libraries/liblmdb/intro.doc +192 -0
  16. package/dependencies/lmdb/libraries/liblmdb/lmdb.h +1817 -0
  17. package/dependencies/lmdb/libraries/liblmdb/mdb.c +12555 -0
  18. package/dependencies/lmdb/libraries/liblmdb/mdb_copy.1 +74 -0
  19. package/dependencies/lmdb/libraries/liblmdb/mdb_copy.c +106 -0
  20. package/dependencies/lmdb/libraries/liblmdb/mdb_drop.1 +53 -0
  21. package/dependencies/lmdb/libraries/liblmdb/mdb_drop.c +154 -0
  22. package/dependencies/lmdb/libraries/liblmdb/mdb_dump.1 +94 -0
  23. package/dependencies/lmdb/libraries/liblmdb/mdb_dump.c +333 -0
  24. package/dependencies/lmdb/libraries/liblmdb/mdb_load.1 +97 -0
  25. package/dependencies/lmdb/libraries/liblmdb/mdb_load.c +530 -0
  26. package/dependencies/lmdb/libraries/liblmdb/mdb_stat.1 +83 -0
  27. package/dependencies/lmdb/libraries/liblmdb/mdb_stat.c +276 -0
  28. package/dependencies/lmdb/libraries/liblmdb/midl-sparse.c +452 -0
  29. package/dependencies/lmdb/libraries/liblmdb/midl.c +452 -0
  30. package/dependencies/lmdb/libraries/liblmdb/midl.h +208 -0
  31. package/dependencies/lmdb/libraries/liblmdb/module.c +101 -0
  32. package/dependencies/lmdb/libraries/liblmdb/module.h +16 -0
  33. package/dependencies/lmdb/libraries/liblmdb/mtest.c +178 -0
  34. package/dependencies/lmdb/libraries/liblmdb/mtest2.c +124 -0
  35. package/dependencies/lmdb/libraries/liblmdb/mtest3.c +133 -0
  36. package/dependencies/lmdb/libraries/liblmdb/mtest4.c +168 -0
  37. package/dependencies/lmdb/libraries/liblmdb/mtest5.c +135 -0
  38. package/dependencies/lmdb/libraries/liblmdb/mtest6.c +141 -0
  39. package/dependencies/lmdb/libraries/liblmdb/mtest_enc.c +190 -0
  40. package/dependencies/lmdb/libraries/liblmdb/mtest_enc2.c +189 -0
  41. package/dependencies/lmdb/libraries/liblmdb/mtest_remap.c +177 -0
  42. package/dependencies/lmdb/libraries/liblmdb/sample-bdb.txt +73 -0
  43. package/dependencies/lmdb/libraries/liblmdb/sample-mdb.txt +62 -0
  44. package/dependencies/lmdb/libraries/liblmdb/tooltag +27 -0
  45. package/dependencies/lmdb-data-v1/libraries/liblmdb/CHANGES +266 -0
  46. package/dependencies/lmdb-data-v1/libraries/liblmdb/COPYRIGHT +20 -0
  47. package/dependencies/lmdb-data-v1/libraries/liblmdb/Doxyfile +1631 -0
  48. package/dependencies/lmdb-data-v1/libraries/liblmdb/LICENSE +47 -0
  49. package/dependencies/lmdb-data-v1/libraries/liblmdb/intro.doc +192 -0
  50. package/dependencies/lmdb-data-v1/libraries/liblmdb/lmdb.h +1608 -0
  51. package/dependencies/lmdb-data-v1/libraries/liblmdb/mdb.c +10320 -0
  52. package/dependencies/lmdb-data-v1/libraries/liblmdb/mdb_copy.1 +55 -0
  53. package/dependencies/lmdb-data-v1/libraries/liblmdb/mdb_copy.c +82 -0
  54. package/dependencies/lmdb-data-v1/libraries/liblmdb/mdb_dump.1 +75 -0
  55. package/dependencies/lmdb-data-v1/libraries/liblmdb/mdb_dump.c +319 -0
  56. package/dependencies/lmdb-data-v1/libraries/liblmdb/mdb_load.1 +84 -0
  57. package/dependencies/lmdb-data-v1/libraries/liblmdb/mdb_load.c +496 -0
  58. package/dependencies/lmdb-data-v1/libraries/liblmdb/mdb_stat.1 +64 -0
  59. package/dependencies/lmdb-data-v1/libraries/liblmdb/mdb_stat.c +263 -0
  60. package/dependencies/lmdb-data-v1/libraries/liblmdb/midl.c +359 -0
  61. package/dependencies/lmdb-data-v1/libraries/liblmdb/midl.h +186 -0
  62. package/dependencies/lmdb-data-v1/libraries/liblmdb/mtest.c +177 -0
  63. package/dependencies/lmdb-data-v1/libraries/liblmdb/mtest2.c +124 -0
  64. package/dependencies/lmdb-data-v1/libraries/liblmdb/mtest3.c +133 -0
  65. package/dependencies/lmdb-data-v1/libraries/liblmdb/mtest4.c +168 -0
  66. package/dependencies/lmdb-data-v1/libraries/liblmdb/mtest5.c +135 -0
  67. package/dependencies/lmdb-data-v1/libraries/liblmdb/mtest6.c +141 -0
  68. package/dependencies/lmdb-data-v1/libraries/liblmdb/sample-bdb.txt +73 -0
  69. package/dependencies/lmdb-data-v1/libraries/liblmdb/sample-mdb.txt +62 -0
  70. package/dependencies/lmdb-data-v1/libraries/liblmdb/tooltag +22 -0
  71. package/dependencies/lz4/LICENSE +11 -0
  72. package/dependencies/lz4/lib/LICENSE +24 -0
  73. package/dependencies/lz4/lib/Makefile +225 -0
  74. package/dependencies/lz4/lib/README.md +169 -0
  75. package/dependencies/lz4/lib/dll/example/Makefile +63 -0
  76. package/dependencies/lz4/lib/dll/example/README.md +69 -0
  77. package/dependencies/lz4/lib/dll/example/fullbench-dll.sln +25 -0
  78. package/dependencies/lz4/lib/dll/example/fullbench-dll.vcxproj +182 -0
  79. package/dependencies/lz4/lib/dll/liblz4.def +62 -0
  80. package/dependencies/lz4/lib/liblz4-dll.rc.in +35 -0
  81. package/dependencies/lz4/lib/liblz4.pc.in +14 -0
  82. package/dependencies/lz4/lib/lz4.c +2722 -0
  83. package/dependencies/lz4/lib/lz4.h +842 -0
  84. package/dependencies/lz4/lib/lz4file.c +311 -0
  85. package/dependencies/lz4/lib/lz4file.h +93 -0
  86. package/dependencies/lz4/lib/lz4frame.c +2078 -0
  87. package/dependencies/lz4/lib/lz4frame.h +692 -0
  88. package/dependencies/lz4/lib/lz4frame_static.h +47 -0
  89. package/dependencies/lz4/lib/lz4hc.c +1631 -0
  90. package/dependencies/lz4/lib/lz4hc.h +413 -0
  91. package/dependencies/lz4/lib/xxhash.c +1030 -0
  92. package/dependencies/lz4/lib/xxhash.h +328 -0
  93. package/dependencies/v8/v8-fast-api-calls-v16.h +791 -0
  94. package/dependencies/v8/v8-fast-api-calls.h +888 -0
  95. package/dict/dict.txt +1 -0
  96. package/dict/dict2.txt +1 -0
  97. package/dist/index.cjs +2950 -0
  98. package/dist/index.cjs.map +1 -0
  99. package/index.d.cts +420 -0
  100. package/index.d.ts +450 -0
  101. package/index.js +38 -0
  102. package/keys.js +116 -0
  103. package/level.js +27 -0
  104. package/native.js +85 -0
  105. package/node-index.js +32 -0
  106. package/open.js +448 -0
  107. package/package.json +124 -0
  108. package/read.js +833 -0
  109. package/rollup.config.js +12 -0
  110. package/src/compression.cpp +225 -0
  111. package/src/cursor.cpp +395 -0
  112. package/src/dbi.cpp +382 -0
  113. package/src/env.cpp +1030 -0
  114. package/src/lmdb-js.cpp +64 -0
  115. package/src/lmdb-js.h +633 -0
  116. package/src/misc.cpp +593 -0
  117. package/src/ordered-binary.cpp +46 -0
  118. package/src/txn.cpp +210 -0
  119. package/src/v8-functions.cpp +170 -0
  120. package/src/windows.c +35 -0
  121. package/src/writer.cpp +537 -0
  122. package/util/RangeIterable.js +236 -0
  123. package/util/set-optional-deps.cjs +14 -0
  124. package/util/when.js +8 -0
  125. package/write.js +912 -0
package/index.d.cts ADDED
@@ -0,0 +1,420 @@
1
+ declare namespace lmdb {
2
+ export function open<V = any, K extends Key = Key>(path: string, options: RootDatabaseOptions): RootDatabase<V, K>
3
+ export function open<V = any, K extends Key = Key>(options: RootDatabaseOptionsWithPath): RootDatabase<V, K>
4
+ export function openAsClass<V = any, K extends Key = Key>(options: RootDatabaseOptionsWithPath): DatabaseClass<V, K>
5
+
6
+ class Database<V = any, K extends Key = Key> {
7
+ /**
8
+ * Get the value stored by given id/key
9
+ * @param id The key for the entry
10
+ **/
11
+ get(id: K, options?: GetOptions): V | undefined
12
+ /**
13
+ * Get the entry stored by given id/key, which includes both the value and the version number (if available)
14
+ * @param id The key for the entry
15
+ * @param options Extra options
16
+ **/
17
+ getEntry(id: K, options?: GetOptions): {
18
+ value: V
19
+ version?: number
20
+ } | undefined
21
+
22
+ /**
23
+ * Get the value stored by given id/key in binary format, as a Buffer
24
+ * @param id The key for the entry
25
+ **/
26
+ getBinary(id: K): Buffer | undefined
27
+
28
+ /**
29
+ * Get the value stored by given id/key in binary format, as a temporary Buffer.
30
+ * This is faster, but the data is only valid until the next get operation (then it will be overwritten).
31
+ * @param id The key for the entry
32
+ **/
33
+ getBinaryFast(id: K): Buffer | undefined
34
+
35
+ /**
36
+ * For random access structures and "fast" binary data, the underlying data is volatile,
37
+ * and not safe to access after the next get. This function allows the data to
38
+ * be copied as needed for safe access in the future. This can be used with buffers and random
39
+ * access data structures.
40
+ * @param data The data to be copied
41
+ **/
42
+ retain(data: any): any
43
+
44
+ /**
45
+ * Asynchronously fetch the values stored by the given ids and accesses all
46
+ * pages to ensure that any hard page faults and disk I/O are performed
47
+ * asynchronously in a separate thread. Once completed, synchronous
48
+ * gets to the same entries will most likely be in memory and fast.
49
+ * @param ids The keys for the entries to prefetch
50
+ **/
51
+ prefetch(ids: K[], callback?: Function): Promise<void>
52
+
53
+ /**
54
+ * Asynchronously get the values stored by the given ids and return the
55
+ * values in array corresponding to the array of ids.
56
+ * @param ids The keys for the entries to get
57
+ **/
58
+ getMany(ids: K[], callback?: (error: any, values: V[]) => any): Promise<(V | undefined)[]>
59
+
60
+ /**
61
+ * Store the provided value, using the provided id/key
62
+ * @param id The key for the entry
63
+ * @param value The value to store
64
+ **/
65
+ put(id: K, value: V): Promise<boolean>
66
+ /**
67
+ * Store the provided value, using the provided id/key and version number, and optionally the required
68
+ * existing version
69
+ * @param id The key for the entry
70
+ * @param value The value to store
71
+ * @param version The version number to assign to this entry
72
+ * @param ifVersion If provided the put will only succeed if the previous version number matches this (atomically checked)
73
+ **/
74
+ put(id: K, value: V, version: number, ifVersion?: number): Promise<boolean>
75
+ /**
76
+ * Remove the entry with the provided id/key
77
+ * @param id The key for the entry to remove
78
+ **/
79
+ remove(id: K): Promise<boolean>
80
+ /**
81
+ * Remove the entry with the provided id/key, conditionally based on the provided existing version number
82
+ * @param id The key for the entry to remove
83
+ * @param ifVersion If provided the remove will only succeed if the previous version number matches this (atomically checked)
84
+ **/
85
+ remove(id: K, ifVersion: number): Promise<boolean>
86
+ /**
87
+ * Remove the entry with the provided id/key and value (mainly used for dupsort databases) and optionally the required
88
+ * existing version
89
+ * @param id The key for the entry to remove
90
+ * @param valueToRemove The value for the entry to remove
91
+ **/
92
+ remove(id: K, valueToRemove: V): Promise<boolean>
93
+ /**
94
+ * Synchronously store the provided value, using the provided id/key, will return after the data has been written.
95
+ * @param id The key for the entry
96
+ * @param value The value to store
97
+ **/
98
+ putSync(id: K, value: V): void
99
+ /**
100
+ * Synchronously store the provided value, using the provided id/key and version number
101
+ * @param id The key for the entry
102
+ * @param value The value to store
103
+ * @param version The version number to assign to this entry
104
+ **/
105
+ putSync(id: K, value: V, version: number): void
106
+ /**
107
+ * Synchronously store the provided value, using the provided id/key and options
108
+ * @param id The key for the entry
109
+ * @param value The value to store
110
+ * @param options The version number to assign to this entry
111
+ **/
112
+ putSync(id: K, value: V, options: PutOptions): void
113
+ /**
114
+ * Synchronously remove the entry with the provided id/key
115
+ * existing version
116
+ * @param id The key for the entry to remove
117
+ **/
118
+ removeSync(id: K): boolean
119
+ /**
120
+ * Synchronously remove the entry with the provided id/key and value (mainly used for dupsort databases)
121
+ * existing version
122
+ * @param id The key for the entry to remove
123
+ * @param valueToRemove The value for the entry to remove
124
+ **/
125
+ removeSync(id: K, valueToRemove: V): boolean
126
+ /**
127
+ * Get all the values for the given key (for dupsort databases)
128
+ * existing version
129
+ * @param key The key for the entry to remove
130
+ * @param options The options for the iterator
131
+ **/
132
+ getValues(key: K, options?: RangeOptions): RangeIterable<V>
133
+ /**
134
+ * Get the count of all the values for the given key (for dupsort databases)
135
+ * existing version
136
+ * @param options The options for the range/iterator
137
+ **/
138
+ getValuesCount(key: K, options?: RangeOptions): number
139
+ /**
140
+ * Get all the unique keys for the given range
141
+ * existing version
142
+ * @param options The options for the range/iterator
143
+ **/
144
+ getKeys(options?: RangeOptions): RangeIterable<K>
145
+ /**
146
+ * Get the count of all the unique keys for the given range
147
+ * existing version
148
+ * @param options The options for the range/iterator
149
+ **/
150
+ getKeysCount(options?: RangeOptions): number
151
+ /**
152
+ * Get all the entries for the given range
153
+ * existing version
154
+ * @param options The options for the range/iterator
155
+ **/
156
+ getRange(options?: RangeOptions): RangeIterable<{ key: K, value: V, version?: number }>
157
+ /**
158
+ * Get the count of all the entries for the given range
159
+ * existing version
160
+ * @param options The options for the range/iterator
161
+ **/
162
+ getCount(options?: RangeOptions): number
163
+ /**
164
+ * @deprecated since version 2.0, use transaction() instead
165
+ */
166
+ transactionAsync<T>(action: () => T): T
167
+ /**
168
+ * Execute a transaction asynchronously, running all the actions within the action callback in the transaction,
169
+ * and committing the transaction after the action callback completes.
170
+ * existing version
171
+ * @param action The function to execute within the transaction
172
+ **/
173
+ transaction<T>(action: () => T): Promise<T>
174
+ /**
175
+ * Execute a transaction synchronously, running all the actions within the action callback in the transaction,
176
+ * and committing the transaction after the action callback completes.
177
+ * existing version
178
+ * @param action The function to execute within the transaction
179
+ * @params flags Additional flags specifying transaction behavior, this is optional and defaults to abortable, synchronous commits that are flushed to disk before returning
180
+ **/
181
+ transactionSync<T>(action: () => T, flags?: TransactionFlags): T
182
+ /**
183
+ * Execute a transaction asynchronously, running all the actions within the action callback in the transaction,
184
+ * and committing the transaction after the action callback completes.
185
+ * existing version
186
+ * @param action The function to execute within the transaction
187
+ **/
188
+ childTransaction<T>(action: () => T): Promise<T>
189
+ /**
190
+ * Returns the current transaction and marks it as in use. This can then be explicitly used for read operations
191
+ * @returns The transaction object
192
+ **/
193
+ useReadTransaction(): Transaction
194
+ /**
195
+ * Execute a set of write operations that will all be batched together in next queued asynchronous transaction.
196
+ * @param action The function to execute with a set of write operations.
197
+ **/
198
+ batch<T>(action?: () => any): Promise<boolean>
199
+ /**
200
+ * Execute writes actions that are all conditionally dependent on the entry with the provided key having the provided
201
+ * version number (checked atomically).
202
+ * @param id Key of the entry to check
203
+ * @param ifVersion The require version number of the entry for all actions to succeed
204
+ * @param action The function to execute with actions that will be dependent on this condition
205
+ **/
206
+ ifVersion(id: K, ifVersion: number, action: () => any): Promise<boolean>
207
+ /**
208
+ * Execute writes actions that are all conditionally dependent on the entry with the provided key
209
+ * not existing (checked atomically).
210
+ * @param id Key of the entry to check
211
+ * @param action The function to execute with actions that will be dependent on this condition
212
+ **/
213
+ ifNoExists(id: K, action: () => any): Promise<boolean>
214
+ /**
215
+ * Check if an entry for the provided key exists
216
+ * @param id Key of the entry to check
217
+ */
218
+ doesExist(key: K): boolean
219
+ /**
220
+ * Check if an entry for the provided key/value exists
221
+ * @param id Key of the entry to check
222
+ * @param value Value of the entry to check
223
+ */
224
+ doesExist(key: K, value: V): boolean
225
+ /**
226
+ * Check if an entry for the provided key exists with the expected version
227
+ * @param id Key of the entry to check
228
+ * @param version Expected version
229
+ */
230
+ doesExist(key: K, version: number): boolean
231
+ /**
232
+ * @deprecated since version 2.0, use drop() or dropSync() instead
233
+ */
234
+ deleteDB(): Promise<void>
235
+ /**
236
+ * Delete this database/store (asynchronously).
237
+ **/
238
+ drop(): Promise<void>
239
+ /**
240
+ * Synchronously delete this database/store.
241
+ **/
242
+ dropSync(): void
243
+ /**
244
+ * @deprecated since version 2.0, use clearAsync() or clearSync() instead
245
+ */
246
+ clear(): Promise<void>
247
+ /**
248
+ * Asynchronously clear all the entries from this database/store.
249
+ **/
250
+ clearAsync(): Promise<void>
251
+ /**
252
+ * Synchronously clear all the entries from this database/store.
253
+ **/
254
+ clearSync(): void
255
+ /** A promise-like object that resolves when previous writes have been committed. */
256
+ committed: Promise<boolean>
257
+ /** A promise-like object that resolves when previous writes have been committed and fully flushed/synced to disk/storage. */
258
+ flushed: Promise<boolean>
259
+ /**
260
+ * Check the reader locks and remove any stale reader locks. Returns the number of stale locks that were removed.
261
+ **/
262
+ readerCheck(): number
263
+ /**
264
+ * Returns a string that describes all the current reader locks, useful for debugging if reader locks aren't being removed.
265
+ **/
266
+ readerList(): string
267
+ /**
268
+ * Returns statistics about the current database
269
+ **/
270
+ getStats(): {}
271
+ /**
272
+ * Explicitly force the read transaction to reset to the latest snapshot/version of the database
273
+ **/
274
+ resetReadTxn(): void
275
+ /**
276
+ * Make a snapshot copy of the current database at the indicated path
277
+ * @param path Path to store the backup
278
+ * @param compact Apply compaction while making the backup (slower and smaller)
279
+ **/
280
+ backup(path: string, compact: boolean): Promise<void>
281
+ /**
282
+ * Close the current database.
283
+ **/
284
+ close(): Promise<void>
285
+ /**
286
+ * Add event listener
287
+ */
288
+ on(event: 'beforecommit' | 'aftercommit', callback: (event: any) => void): void
289
+ }
290
+ /* A constant that can be returned from a transaction to indicate that the transaction should be aborted */
291
+ export const ABORT: {};
292
+ /* A constant that can be used as a conditional versions for put and ifVersion to indicate that the write should conditional on the key/entry existing */
293
+ export const IF_EXISTS: number;
294
+ class RootDatabase<V = any, K extends Key = Key> extends Database<V, K> {
295
+ /**
296
+ * Open a database store using the provided options.
297
+ **/
298
+ openDB<OV = V, OK extends Key = K>(options: DatabaseOptions & { name: string }): Database<OV, OK>
299
+ /**
300
+ * Open a database store using the provided options.
301
+ **/
302
+ openDB<OV = V, OK extends Key = K>(dbName: string, dbOptions: DatabaseOptions): Database<OV, OK>
303
+ }
304
+ class DatabaseClass<V = any, K extends Key = Key> {
305
+ new(name: string | null, options: DatabaseOptions): Database<V, K>
306
+ }
307
+
308
+ type Key = Key[] | string | symbol | number | boolean | Uint8Array;
309
+
310
+ interface DatabaseOptions {
311
+ name?: string
312
+ cache?: boolean | {}
313
+ compression?: boolean | CompressionOptions
314
+ encoding?: 'msgpack' | 'json' | 'string' | 'binary' | 'ordered-binary'
315
+ sharedStructuresKey?: Key
316
+ useVersions?: boolean
317
+ keyEncoding?: 'uint32' | 'binary' | 'ordered-binary'
318
+ dupSort?: boolean
319
+ strictAsyncOrder?: boolean
320
+ }
321
+ interface RootDatabaseOptions extends DatabaseOptions {
322
+ /** The maximum number of databases to be able to open (there is some extra overhead if this is set very high).*/
323
+ maxDbs?: number
324
+ /** Set a longer delay (in milliseconds) to wait longer before committing writes to increase the number of writes per transaction (higher latency, but more efficient) **/
325
+ commitDelay?: number
326
+ mapSize?: number
327
+ pageSize?: number
328
+ overlappingSync?: boolean
329
+ separateFlushed?: boolean
330
+ remapChunks?: boolean
331
+ /** This provides a small performance boost (when not using useWritemap) for writes, by skipping zero'ing out malloc'ed data, but can leave application data in unused portions of the database. This is recommended unless there are concerns of database files being accessible. */
332
+ noMemInit?: boolean
333
+ /** Use writemaps, discouraged at this. This improves performance by reducing malloc calls, but it is possible for a stray pointer to corrupt data. */
334
+ useWritemap?: boolean
335
+ noSubdir?: boolean
336
+ noSync?: boolean
337
+ noMetaSync?: boolean
338
+ readOnly?: boolean
339
+ maxReaders?: number
340
+ }
341
+ interface RootDatabaseOptionsWithPath extends RootDatabaseOptions {
342
+ path: string
343
+ }
344
+ interface CompressionOptions {
345
+ threshold?: number
346
+ dictionary?: Buffer
347
+ }
348
+ interface GetOptions {
349
+ }
350
+ interface RangeOptions {
351
+ /** Starting key for a range **/
352
+ start?: Key
353
+ /** Ending key for a range **/
354
+ end?: Key
355
+ /** Iterate through the entries in reverse order **/
356
+ reverse?: boolean
357
+ /** Include version numbers in each entry returned **/
358
+ versions?: boolean
359
+ /** The maximum number of entries to return **/
360
+ limit?: number
361
+ /** The number of entries to skip **/
362
+ offset?: number
363
+ /** Use a snapshot of the database from when the iterator started **/
364
+ snapshot?: boolean
365
+ /** Use the provided transaction for this range query */
366
+ transaction?: Transaction
367
+ /** Skip a key that exactly matches the starting key */
368
+ exclusiveStart?: boolean
369
+ /** Include an exact match for the ending key in the range */
370
+ inclusiveEnd?: boolean
371
+ }
372
+ interface PutOptions {
373
+ /* Append to the database using MDB_APPEND, which can be faster */
374
+ append?: boolean
375
+ /* Append to a dupsort database using MDB_APPENDDUP, which can be faster */
376
+ appendDup?: boolean
377
+ /* Perform put with MDB_NOOVERWRITE which will fail if the entry for the key already exists */
378
+ noOverwrite?: boolean
379
+ /* Perform put with MDB_NODUPDATA which will fail if the entry for the key/value already exists */
380
+ noDupData?: boolean
381
+ /* The version of the entry to set */
382
+ version?: number
383
+ }
384
+ export enum TransactionFlags {
385
+ /* Indicates that the transaction needs to be abortable */
386
+ ABORTABLE = 1,
387
+ /* Indicates that the transaction needs to be committed before returning */
388
+ SYNCHRONOUS_COMMIT = 2,
389
+ /* Indicates that the function can return before the transaction has been flushed to disk */
390
+ NO_SYNC_FLUSH = 0x10000
391
+ }
392
+ class RangeIterable<T> implements Iterable<T> {
393
+ map<U>(callback: (entry: T) => U): RangeIterable<U>
394
+ flatMap<U>(callback: (entry: T) => U[]): RangeIterable<U>
395
+ slice(start: number, end: number): RangeIterable<T>
396
+ filter(callback: (entry: T) => any): RangeIterable<T>
397
+ [Symbol.iterator]() : Iterator<T>
398
+ forEach(callback: (entry: T) => any): void
399
+ concat(next_iterable: Iterable<T>): RangeIterable<T>
400
+ onDone?: Function
401
+ asArray: T[]
402
+ }
403
+ class Transaction {
404
+ /**
405
+ * When there is no more need for the transaction and it can be closed.
406
+ */
407
+ done(): void
408
+ }
409
+ export function getLastVersion(): number
410
+ export function compareKeys(a: Key, b: Key): number
411
+ class Binary {}
412
+ /* Wrap a Buffer/Uint8Array for direct assignment as a value bypassing any encoding, for put (and doesExist) operations.
413
+ */
414
+ export function asBinary(buffer: Uint8Array): Binary
415
+ /* Indicates if V8 accelerated functions are enabled. If this is false, some functions will be a little slower, and you may want to npm install --build-from-source to enable maximum performance */
416
+ export let v8AccelerationEnabled: boolean
417
+ /* Return database augmented with methods to better conform to levelup */
418
+ export function levelup(database: Database): Database
419
+ }
420
+ export = lmdb