@harperfast/rocksdb-js 2.4.1 → 2.6.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.
- package/README.md +224 -15
- package/bin/rocksdb-js.mjs +67 -3
- package/dist/index.cjs +293 -38
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1382 -1125
- package/dist/index.d.mts +1382 -1125
- package/dist/index.mjs +294 -41
- package/dist/index.mjs.map +1 -1
- package/docs/backups.md +15 -0
- package/docs/stats.md +2 -0
- package/docs/transaction-log.md +10 -0
- package/package.json +17 -17
package/dist/index.d.mts
CHANGED
|
@@ -1,104 +1,121 @@
|
|
|
1
1
|
import { ExtendedIterable } from "@harperfast/extended-iterable";
|
|
2
|
-
|
|
3
2
|
//#region src/backup.d.ts
|
|
4
3
|
/**
|
|
5
|
-
* Options for creating a backup via `db.backup()`.
|
|
6
|
-
*
|
|
7
|
-
* Backups are whole-database: every column family, the manifest, and (unless
|
|
8
|
-
* `backupLogFiles` is disabled) the write-ahead log are captured. A backup is
|
|
9
|
-
* not scoped to an individual `Store`.
|
|
10
|
-
*/
|
|
4
|
+
* Options for creating a backup via `db.backup()`.
|
|
5
|
+
*
|
|
6
|
+
* Backups are whole-database: every column family, the manifest, and (unless
|
|
7
|
+
* `backupLogFiles` is disabled) the write-ahead log are captured. A backup is
|
|
8
|
+
* not scoped to an individual `Store`.
|
|
9
|
+
*/
|
|
11
10
|
interface BackupOptions {
|
|
12
11
|
/**
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
* Include write-ahead log files in the backup. Defaults to `true`.
|
|
13
|
+
*/
|
|
15
14
|
backupLogFiles?: boolean;
|
|
16
15
|
/**
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
* Preflight the destination volume and reject the backup when it lacks room.
|
|
17
|
+
* Defaults to `true`. The rejection is an I/O error whose message reports the
|
|
18
|
+
* available and required bytes (it is not distinguishable by an `err.code`).
|
|
19
|
+
*
|
|
20
|
+
* The required size is estimated conservatively as a *full* copy of the
|
|
21
|
+
* database's live files, plus the transaction-log snapshot when
|
|
22
|
+
* `transactionLogs` is enabled (a backup only ever copies files, so this can
|
|
23
|
+
* never under-estimate the bytes written). For incremental backups to a
|
|
24
|
+
* right-sized volume this may over-reject — set `false` to skip the check in
|
|
25
|
+
* that case. The check also self-disables when free space is unknowable (e.g.
|
|
26
|
+
* some network filesystems report 0), so it never blocks a backup on an
|
|
27
|
+
* untrustworthy number.
|
|
28
|
+
*
|
|
29
|
+
* Only applies to directory-target backups; the streaming backup path is
|
|
30
|
+
* unaffected.
|
|
31
|
+
*/
|
|
32
|
+
checkDiskSpace?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Flush the memtable before backing up. Defaults to `true` when the database
|
|
35
|
+
* was opened with `disableWAL` (otherwise unflushed data would be lost from
|
|
36
|
+
* the backup), and `false` otherwise.
|
|
37
|
+
*/
|
|
21
38
|
flushBeforeBackup?: boolean;
|
|
22
39
|
/**
|
|
23
|
-
|
|
24
|
-
|
|
40
|
+
* Number of background threads used to copy files. Defaults to `1`.
|
|
41
|
+
*/
|
|
25
42
|
maxBackgroundOperations?: number;
|
|
26
43
|
/**
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
44
|
+
* Arbitrary application metadata stored with the backup and returned by
|
|
45
|
+
* `backups.list()`.
|
|
46
|
+
*/
|
|
30
47
|
metadata?: string;
|
|
31
48
|
/**
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
49
|
+
* Distinguish shared files by checksum to avoid collisions across databases.
|
|
50
|
+
* Defaults to `true`. Only relevant when `shareTableFiles` is enabled.
|
|
51
|
+
*/
|
|
35
52
|
shareFilesWithChecksum?: boolean;
|
|
36
53
|
/**
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
54
|
+
* Share table/blob files between backups in the same directory to enable
|
|
55
|
+
* incremental backups. Defaults to `true`.
|
|
56
|
+
*/
|
|
40
57
|
shareTableFiles?: boolean;
|
|
41
58
|
/**
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
59
|
+
* `fsync` backup files — including the transaction log snapshot when
|
|
60
|
+
* `transactionLogs` is enabled — for crash consistency. Defaults to `true`.
|
|
61
|
+
*/
|
|
45
62
|
sync?: boolean;
|
|
46
63
|
/**
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
64
|
+
* Snapshot the transaction log store into
|
|
65
|
+
* `<backupDir>/transaction_logs/<backupId>/`. Defaults to `false`. This is an
|
|
66
|
+
* all-or-nothing snapshot per backup (not incremental); `backups.delete()` and
|
|
67
|
+
* `backups.purge()` remove the corresponding log snapshots, and
|
|
68
|
+
* `backups.restore()` restores them into the database directory.
|
|
69
|
+
*
|
|
70
|
+
* The snapshot is staged and atomically renamed into place after every file
|
|
71
|
+
* is copied (and fsynced, per `sync`), so a crash mid-backup can never leave
|
|
72
|
+
* a partial snapshot: a backup id either has its complete log snapshot or
|
|
73
|
+
* none at all.
|
|
74
|
+
*
|
|
75
|
+
* The log snapshot is captured just after the RocksDB engine snapshot, so it
|
|
76
|
+
* may include entries committed between the two — the restored logs can run
|
|
77
|
+
* slightly ahead of the restored key-value data, never behind it. That bias
|
|
78
|
+
* is safe for redo-style logs that are replayed against the restored data.
|
|
79
|
+
*/
|
|
63
80
|
transactionLogs?: boolean;
|
|
64
81
|
}
|
|
65
82
|
/**
|
|
66
|
-
* The level of incremental restore to perform.
|
|
67
|
-
*
|
|
68
|
-
* - `purgeAllFiles` (default): purge the destination directory and restore all
|
|
69
|
-
* files from the backup. Destructive but always correct.
|
|
70
|
-
* - `keepLatestDbSessionIdFiles`: efficiently restore a healthy database,
|
|
71
|
-
* reusing existing files that match the backup.
|
|
72
|
-
* - `verifyChecksum`: reuse existing destination files whose checksums match the
|
|
73
|
-
* backup, replacing only mismatched/corrupt files.
|
|
74
|
-
*/
|
|
83
|
+
* The level of incremental restore to perform.
|
|
84
|
+
*
|
|
85
|
+
* - `purgeAllFiles` (default): purge the destination directory and restore all
|
|
86
|
+
* files from the backup. Destructive but always correct.
|
|
87
|
+
* - `keepLatestDbSessionIdFiles`: efficiently restore a healthy database,
|
|
88
|
+
* reusing existing files that match the backup.
|
|
89
|
+
* - `verifyChecksum`: reuse existing destination files whose checksums match the
|
|
90
|
+
* backup, replacing only mismatched/corrupt files.
|
|
91
|
+
*/
|
|
75
92
|
type RestoreMode = "purgeAllFiles" | "keepLatestDbSessionIdFiles" | "verifyChecksum";
|
|
76
93
|
/**
|
|
77
|
-
* Options for restoring a backup via `backups.restore()`.
|
|
78
|
-
*/
|
|
94
|
+
* Options for restoring a backup via `backups.restore()`.
|
|
95
|
+
*/
|
|
79
96
|
interface RestoreOptions {
|
|
80
97
|
/**
|
|
81
|
-
|
|
82
|
-
|
|
98
|
+
* The backup id to restore. Defaults to the latest non-corrupt backup.
|
|
99
|
+
*/
|
|
83
100
|
backupId?: number;
|
|
84
101
|
/**
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
102
|
+
* Directory to restore write-ahead log files into. Defaults to the database
|
|
103
|
+
* directory.
|
|
104
|
+
*/
|
|
88
105
|
walDir?: string;
|
|
89
106
|
/**
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
107
|
+
* Keep existing log files in `walDir` rather than overwriting them. Defaults
|
|
108
|
+
* to `false`.
|
|
109
|
+
*/
|
|
93
110
|
keepLogFiles?: boolean;
|
|
94
111
|
/**
|
|
95
|
-
|
|
96
|
-
|
|
112
|
+
* The restore strategy. Defaults to `purgeAllFiles`, which is destructive.
|
|
113
|
+
*/
|
|
97
114
|
mode?: RestoreMode;
|
|
98
115
|
}
|
|
99
116
|
/**
|
|
100
|
-
* Information about a single backup, as returned by `backups.list()`.
|
|
101
|
-
*/
|
|
117
|
+
* Information about a single backup, as returned by `backups.list()`.
|
|
118
|
+
*/
|
|
102
119
|
interface BackupInfo {
|
|
103
120
|
/** The backup id (monotonically increasing integer). */
|
|
104
121
|
backupId: number;
|
|
@@ -112,45 +129,64 @@ interface BackupInfo {
|
|
|
112
129
|
appMetadata: string;
|
|
113
130
|
}
|
|
114
131
|
/**
|
|
115
|
-
* Backup management operations that act on a backup directory and do not
|
|
116
|
-
* require an open database. To create a backup, use the `db.backup()` instance
|
|
117
|
-
* method instead (it needs a live database for a consistent snapshot).
|
|
118
|
-
*
|
|
119
|
-
* @example
|
|
120
|
-
* ```typescript
|
|
121
|
-
* import { backups } from '@harperfast/rocksdb-js';
|
|
122
|
-
*
|
|
123
|
-
* const id = await db.backup('/path/to/backups');
|
|
124
|
-
* db.close();
|
|
125
|
-
* await backups.restore('/path/to/backups', '/path/to/restored-db');
|
|
126
|
-
* ```
|
|
127
|
-
*/
|
|
132
|
+
* Backup management operations that act on a backup directory and do not
|
|
133
|
+
* require an open database. To create a backup, use the `db.backup()` instance
|
|
134
|
+
* method instead (it needs a live database for a consistent snapshot).
|
|
135
|
+
*
|
|
136
|
+
* @example
|
|
137
|
+
* ```typescript
|
|
138
|
+
* import { backups } from '@harperfast/rocksdb-js';
|
|
139
|
+
*
|
|
140
|
+
* const id = await db.backup('/path/to/backups');
|
|
141
|
+
* db.close();
|
|
142
|
+
* await backups.restore('/path/to/backups', '/path/to/restored-db');
|
|
143
|
+
* ```
|
|
144
|
+
*/
|
|
128
145
|
declare const backups: {
|
|
129
146
|
/**
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
147
|
+
* Restores a database from a backup directory into a (closed) database
|
|
148
|
+
* directory. The default mode purges the destination directory, so it must
|
|
149
|
+
* not point at a live database.
|
|
150
|
+
*
|
|
151
|
+
* Holds the backup directory lock in shared mode for the duration: multiple
|
|
152
|
+
* restores can read concurrently, but a writer (`db.backup()`, `delete`,
|
|
153
|
+
* `purge`) rejects while a restore is in flight rather than deleting files
|
|
154
|
+
* out from under it — and a restore rejects while a writer holds the lock.
|
|
155
|
+
*
|
|
156
|
+
* The shared lock needs no write access to `backupDir`, so restoring from a
|
|
157
|
+
* read-only backup directory (immutable/WORM store, read-only-mounted volume)
|
|
158
|
+
* works: the lock is taken on an existing `.backup.lock` read-only, degrading
|
|
159
|
+
* to a no-op only when the media is read-only for every process (`EROFS`). A
|
|
160
|
+
* mere permission denial hard-fails instead — it doesn't prove a privileged
|
|
161
|
+
* writer isn't running.
|
|
162
|
+
*/
|
|
134
163
|
restore(backupDir: string, dbDir: string, options?: RestoreOptions): Promise<void>;
|
|
135
164
|
/**
|
|
136
|
-
|
|
137
|
-
|
|
165
|
+
* Lists the non-corrupt backups in a backup directory, ordered by id.
|
|
166
|
+
*/
|
|
138
167
|
list(backupDir: string): Promise<BackupInfo[]>;
|
|
139
168
|
/**
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
169
|
+
* Deletes a specific backup. Shared files are reference-counted and only
|
|
170
|
+
* removed once no remaining backup references them.
|
|
171
|
+
*/
|
|
143
172
|
delete(backupDir: string, backupId: number): Promise<void>;
|
|
144
173
|
/**
|
|
145
|
-
|
|
146
|
-
|
|
174
|
+
* Deletes all but the newest `keepCount` backups.
|
|
175
|
+
*/
|
|
147
176
|
purge(backupDir: string, keepCount: number): Promise<void>;
|
|
148
177
|
/**
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
178
|
+
* Verifies a backup's file sizes, and optionally their checksums (which
|
|
179
|
+
* requires reading all backed-up data).
|
|
180
|
+
*
|
|
181
|
+
* When the backup was created with `transactionLogs: true`, the backup's
|
|
182
|
+
* transaction log snapshot (`<backupDir>/transaction_logs/<backupId>/`) is
|
|
183
|
+
* also validated — every log file's header and entry framing must be intact
|
|
184
|
+
* (snapshots are copied on committed entry boundaries, so even a torn tail
|
|
185
|
+
* is a verification failure). Set `verifyTransactionLogs: false` to skip.
|
|
186
|
+
*/
|
|
152
187
|
verify(backupDir: string, backupId: number, options?: {
|
|
153
188
|
verifyWithChecksum?: boolean;
|
|
189
|
+
verifyTransactionLogs?: boolean;
|
|
154
190
|
}): Promise<void>;
|
|
155
191
|
};
|
|
156
192
|
//#endregion
|
|
@@ -190,14 +226,14 @@ interface DBIteratorValue<T> {
|
|
|
190
226
|
value: T;
|
|
191
227
|
}
|
|
192
228
|
/**
|
|
193
|
-
* Wraps the `NativeIterator` C++ binding, decoding keys and values from the
|
|
194
|
-
* shared key/value buffers (fast path) or from per-iteration buffers (slow
|
|
195
|
-
* fallback path used for oversized data or stable-buffer decoders).
|
|
196
|
-
*
|
|
197
|
-
* The native `next()` returns a primitive signal (and writes lengths to the
|
|
198
|
-
* shared `ITERATOR_STATE` buffer) instead of constructing a JS result object,
|
|
199
|
-
* so this class is responsible for building the `IteratorResult`.
|
|
200
|
-
*/
|
|
229
|
+
* Wraps the `NativeIterator` C++ binding, decoding keys and values from the
|
|
230
|
+
* shared key/value buffers (fast path) or from per-iteration buffers (slow
|
|
231
|
+
* fallback path used for oversized data or stable-buffer decoders).
|
|
232
|
+
*
|
|
233
|
+
* The native `next()` returns a primitive signal (and writes lengths to the
|
|
234
|
+
* shared `ITERATOR_STATE` buffer) instead of constructing a JS result object,
|
|
235
|
+
* so this class is responsible for building the `IteratorResult`.
|
|
236
|
+
*/
|
|
201
237
|
declare class DBIterator<T> implements Iterator<DBIteratorValue<T>> {
|
|
202
238
|
#private;
|
|
203
239
|
iterator: InstanceType<typeof NativeIteratorCls>;
|
|
@@ -221,9 +257,51 @@ type CompactOptions = {
|
|
|
221
257
|
end?: Key;
|
|
222
258
|
};
|
|
223
259
|
/**
|
|
224
|
-
*
|
|
225
|
-
|
|
226
|
-
|
|
260
|
+
* A RocksDB block/blob compression algorithm. Which algorithms are actually
|
|
261
|
+
* available depends on the libraries the native binding was compiled with —
|
|
262
|
+
* check `supportedCompression` at runtime. `'none'` disables compression and
|
|
263
|
+
* is always available.
|
|
264
|
+
*/
|
|
265
|
+
type CompressionAlgorithm = "none" | "snappy" | "zlib" | "bzip2" | "lz4" | "lz4hc" | "xpress" | "zstd";
|
|
266
|
+
/**
|
|
267
|
+
* The `compression` open option: either an algorithm name, or an object with
|
|
268
|
+
* an algorithm and an optional level (forwarded to RocksDB's
|
|
269
|
+
* `compression_opts.level`; meaning is algorithm-specific).
|
|
270
|
+
*/
|
|
271
|
+
type CompressionOption = CompressionAlgorithm | {
|
|
272
|
+
algorithm: CompressionAlgorithm;
|
|
273
|
+
level?: number;
|
|
274
|
+
};
|
|
275
|
+
/**
|
|
276
|
+
* The compression currently in effect for a column family, as returned by the
|
|
277
|
+
* `compression` getter. `level` is present only when a non-default compression
|
|
278
|
+
* level is configured.
|
|
279
|
+
*/
|
|
280
|
+
type CompressionInfo = {
|
|
281
|
+
algorithm: CompressionAlgorithm;
|
|
282
|
+
level?: number;
|
|
283
|
+
};
|
|
284
|
+
/**
|
|
285
|
+
* Options for the `Store` class.
|
|
286
|
+
*/
|
|
287
|
+
interface StoreOptions extends Omit<NativeDatabaseOptions, "compression" | "compressionLevel" | "mode" | "transactionLogRetentionMs"> {
|
|
288
|
+
/**
|
|
289
|
+
* The block/blob compression algorithm for this column family. Accepts an
|
|
290
|
+
* algorithm name (`'lz4'`, `'zstd'`, `'none'`, ...) or an object with an
|
|
291
|
+
* `algorithm` and optional `level`. Applies to both SST blocks and blob
|
|
292
|
+
* files (large values). Which algorithms are available depends on the native
|
|
293
|
+
* build — see `supportedCompression`.
|
|
294
|
+
*
|
|
295
|
+
* When omitted, defaults to `lz4` if the build supports it, otherwise
|
|
296
|
+
* RocksDB's own default (Snappy when linked, else no compression).
|
|
297
|
+
* Compression is a dynamically-changeable option: reopening with a
|
|
298
|
+
* different algorithm governs subsequently written files; existing files
|
|
299
|
+
* keep their compression until rewritten by compaction. Use the
|
|
300
|
+
* `compression` getter to read the value currently in effect.
|
|
301
|
+
*
|
|
302
|
+
* @default 'lz4'
|
|
303
|
+
*/
|
|
304
|
+
compression?: CompressionOption;
|
|
227
305
|
decoder?: Encoder | null;
|
|
228
306
|
encoder?: Encoder | null;
|
|
229
307
|
encoding?: Encoding;
|
|
@@ -236,266 +314,293 @@ interface StoreOptions extends Omit<NativeDatabaseOptions, "mode" | "transaction
|
|
|
236
314
|
maxKeySize?: number;
|
|
237
315
|
pessimistic?: boolean;
|
|
238
316
|
/**
|
|
239
|
-
|
|
240
|
-
|
|
317
|
+
* If `true`, the encoder will use a random access structure.
|
|
318
|
+
*/
|
|
241
319
|
randomAccessStructure?: boolean;
|
|
242
320
|
/**
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
321
|
+
* When `true`, the database is opened in read-only mode. Write operations
|
|
322
|
+
* will throw an error with code `ERR_DATABASE_READONLY`.
|
|
323
|
+
*/
|
|
246
324
|
readOnly?: boolean;
|
|
247
325
|
sharedStructuresKey?: symbol;
|
|
248
326
|
/**
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
327
|
+
* A string containing the amount of time or the number of milliseconds to
|
|
328
|
+
* retain transaction logs before purging.
|
|
329
|
+
*
|
|
330
|
+
* @default '3d' (3 days)
|
|
331
|
+
*/
|
|
254
332
|
transactionLogRetention?: number | string;
|
|
255
333
|
}
|
|
256
334
|
/**
|
|
257
|
-
* Options for the `getUserSharedBuffer()` method.
|
|
258
|
-
*/
|
|
335
|
+
* Options for the `getUserSharedBuffer()` method.
|
|
336
|
+
*/
|
|
259
337
|
type UserSharedBufferOptions = {
|
|
260
338
|
callback?: UserSharedBufferCallback;
|
|
261
339
|
};
|
|
262
340
|
/**
|
|
263
|
-
* The return type of `getUserSharedBuffer()`.
|
|
264
|
-
*/
|
|
341
|
+
* The return type of `getUserSharedBuffer()`.
|
|
342
|
+
*/
|
|
265
343
|
type ArrayBufferWithNotify = ArrayBuffer & {
|
|
266
344
|
cancel: () => void;
|
|
267
345
|
notify: () => void;
|
|
268
346
|
};
|
|
269
347
|
/**
|
|
270
|
-
* A store wraps the `NativeDatabase` binding and database settings so that a
|
|
271
|
-
* single database instance can be shared between the main `RocksDatabase`
|
|
272
|
-
* instance and the `Transaction` instance.
|
|
273
|
-
*
|
|
274
|
-
*
|
|
275
|
-
|
|
348
|
+
* A store wraps the `NativeDatabase` binding and database settings so that a
|
|
349
|
+
* single database instance can be shared between the main `RocksDatabase`
|
|
350
|
+
* instance and the `Transaction` instance.
|
|
351
|
+
*
|
|
352
|
+
* A store is bound to a single `RocksDatabase` instance and must not be shared
|
|
353
|
+
* between `RocksDatabase` instances. Each `RocksDatabase` claims its store on
|
|
354
|
+
* construction (see `claim()`); passing a store that another `RocksDatabase`
|
|
355
|
+
* already owns throws. (Sharing with the owning database's `Transaction`
|
|
356
|
+
* instances is expected and allowed.)
|
|
357
|
+
*/
|
|
276
358
|
declare class Store {
|
|
359
|
+
#private;
|
|
277
360
|
/**
|
|
278
|
-
|
|
279
|
-
|
|
361
|
+
* The database instance.
|
|
362
|
+
*/
|
|
280
363
|
db: NativeDatabase;
|
|
281
364
|
/**
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
365
|
+
* The decoder instance. This is commonly the same as the `encoder`
|
|
366
|
+
* instance.
|
|
367
|
+
*/
|
|
285
368
|
decoder: Encoder | null;
|
|
286
369
|
/**
|
|
287
|
-
|
|
288
|
-
|
|
370
|
+
* Whether the decoder copies the buffer when encoding values.
|
|
371
|
+
*/
|
|
289
372
|
decoderCopies: boolean;
|
|
290
373
|
/**
|
|
291
|
-
|
|
292
|
-
|
|
374
|
+
* The compression algorithm (or `{ algorithm, level }`) requested for this
|
|
375
|
+
* store's column family. Normalized and applied when the database opens.
|
|
376
|
+
*/
|
|
377
|
+
compression?: CompressionOption;
|
|
378
|
+
/**
|
|
379
|
+
* Whether to disable the write ahead log.
|
|
380
|
+
*/
|
|
293
381
|
disableWAL: boolean;
|
|
294
382
|
/**
|
|
295
|
-
|
|
296
|
-
|
|
383
|
+
* Whether to enable RocksDB statistics.
|
|
384
|
+
*/
|
|
297
385
|
enableStats: boolean;
|
|
298
386
|
/**
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
387
|
+
* Reusable buffer for encoding values using `writeKey()` when the custom
|
|
388
|
+
* encoder does not provide a `encode()` method.
|
|
389
|
+
*/
|
|
302
390
|
encodeBuffer: BufferWithDataView;
|
|
303
391
|
/**
|
|
304
|
-
|
|
305
|
-
|
|
392
|
+
* The encoder instance.
|
|
393
|
+
*/
|
|
306
394
|
encoder: Encoder | null;
|
|
307
395
|
/**
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
396
|
+
* The encoding used to encode values. Defaults to `'msgpack'` in
|
|
397
|
+
* `RocksDatabase.open()`.
|
|
398
|
+
*/
|
|
311
399
|
encoding: Encoding | null;
|
|
312
400
|
/**
|
|
313
|
-
|
|
314
|
-
|
|
401
|
+
* Encoder specific option used to signal that the data should be frozen.
|
|
402
|
+
*/
|
|
315
403
|
freezeData: boolean;
|
|
316
404
|
/**
|
|
317
|
-
|
|
318
|
-
|
|
405
|
+
* Reusable buffer for encoding keys.
|
|
406
|
+
*/
|
|
319
407
|
keyBuffer: BufferWithDataView;
|
|
320
408
|
/**
|
|
321
|
-
|
|
322
|
-
|
|
409
|
+
* The key encoding to use for keys. Defaults to `'ordered-binary'`.
|
|
410
|
+
*/
|
|
323
411
|
keyEncoding: KeyEncoding;
|
|
324
412
|
/**
|
|
325
|
-
|
|
326
|
-
|
|
413
|
+
* The maximum key size.
|
|
414
|
+
*/
|
|
327
415
|
maxKeySize: number;
|
|
328
416
|
/**
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
417
|
+
* The maximum number of table files RocksDB keeps open. `0` (the default)
|
|
418
|
+
* derives a budget from the effective per-process open-file limit (an
|
|
419
|
+
* eighth of the limit — several databases can share one process — clamped
|
|
420
|
+
* to `[1024, 262144]`); `-1` holds every table file open (the RocksDB
|
|
421
|
+
* default, which can exhaust the process file-descriptor limit when
|
|
422
|
+
* compaction falls behind under sustained ingest); a positive `int32` is
|
|
423
|
+
* an explicit cap.
|
|
424
|
+
*/
|
|
425
|
+
maxOpenFiles?: number;
|
|
426
|
+
/**
|
|
427
|
+
* The maximum number of memtables that can be queued per column family
|
|
428
|
+
* before writes stall. Higher values absorb write bursts while flushes catch
|
|
429
|
+
* up, at the cost of memory.
|
|
430
|
+
*/
|
|
333
431
|
maxWriteBufferNumber?: number;
|
|
334
432
|
/**
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
433
|
+
* The bytes of recent memtable history to retain in memory for transaction
|
|
434
|
+
* conflict checking. `-1` derives the value from
|
|
435
|
+
* `maxWriteBufferNumber * writeBufferSize`.
|
|
436
|
+
*/
|
|
339
437
|
maxWriteBufferSizeToMaintain?: number;
|
|
340
438
|
/**
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
439
|
+
* The total memtable budget in bytes across all column families. When the
|
|
440
|
+
* sum of memtables reaches this size, RocksDB flushes the largest one. `0`
|
|
441
|
+
* disables the global trigger so per-CF `writeBufferSize` drives flushing.
|
|
442
|
+
*/
|
|
345
443
|
dbWriteBufferSize?: number;
|
|
346
444
|
/**
|
|
347
|
-
|
|
348
|
-
|
|
445
|
+
* The name of the store (e.g. the column family). Defaults to `'default'`.
|
|
446
|
+
*/
|
|
349
447
|
name: string;
|
|
350
448
|
/**
|
|
351
|
-
|
|
352
|
-
|
|
449
|
+
* Whether to disable the block cache.
|
|
450
|
+
*/
|
|
353
451
|
noBlockCache?: boolean;
|
|
354
452
|
/**
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
453
|
+
* The number of threads to use for parallel operations. This is a RocksDB
|
|
454
|
+
* option. When undefined, the native layer picks
|
|
455
|
+
* `max(1, hardware_concurrency() / 2)`.
|
|
456
|
+
*/
|
|
359
457
|
parallelismThreads?: number;
|
|
360
458
|
/**
|
|
361
|
-
|
|
362
|
-
|
|
459
|
+
* The path to the database.
|
|
460
|
+
*/
|
|
363
461
|
path: string;
|
|
364
462
|
/**
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
463
|
+
* Whether to use pessimistic locking for transactions. When `true`,
|
|
464
|
+
* transactions will fail as soon as a conflict is detected. When `false`,
|
|
465
|
+
* transactions will only fail when `commit()` is called.
|
|
466
|
+
*/
|
|
369
467
|
pessimistic: boolean;
|
|
370
468
|
/**
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
469
|
+
* Whether the database is open in readonly mode. When `true`, write
|
|
470
|
+
* operations will throw an error with code `ERR_DATABASE_READONLY`.
|
|
471
|
+
*/
|
|
374
472
|
readOnly: boolean;
|
|
375
473
|
/**
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
474
|
+
* Encoder specific flag used to signal that the encoder should use a random
|
|
475
|
+
* access structure.
|
|
476
|
+
*/
|
|
379
477
|
randomAccessStructure: boolean;
|
|
380
478
|
/**
|
|
381
|
-
|
|
382
|
-
|
|
479
|
+
* The function used to encode keys.
|
|
480
|
+
*/
|
|
383
481
|
readKey: ReadKeyFunction<Key>;
|
|
384
482
|
/**
|
|
385
|
-
|
|
386
|
-
|
|
483
|
+
* The key used to store shared structures.
|
|
484
|
+
*/
|
|
387
485
|
sharedStructuresKey?: symbol;
|
|
388
486
|
/**
|
|
389
|
-
|
|
390
|
-
|
|
487
|
+
* The level of statistics to capture.
|
|
488
|
+
*/
|
|
391
489
|
statsLevel?: (typeof stats.StatsLevel)[keyof typeof stats.StatsLevel];
|
|
392
490
|
/**
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
491
|
+
* The threshold for the transaction log file's last modified time to be
|
|
492
|
+
* older than the retention period before it is rotated to the next sequence
|
|
493
|
+
* number. A threshold of 0 means ignore age check.
|
|
494
|
+
*/
|
|
397
495
|
transactionLogMaxAgeThreshold?: number;
|
|
398
496
|
/**
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
497
|
+
* The maximum size of a transaction log before it is rotated to the next
|
|
498
|
+
* sequence number.
|
|
499
|
+
*/
|
|
402
500
|
transactionLogMaxSize?: number;
|
|
403
501
|
/**
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
502
|
+
* A string containing the amount of time or the number of milliseconds to
|
|
503
|
+
* retain transaction logs before purging.
|
|
504
|
+
*
|
|
505
|
+
* @default '3d' (3 days)
|
|
506
|
+
*/
|
|
409
507
|
transactionLogRetention?: number | string;
|
|
410
508
|
/**
|
|
411
|
-
|
|
412
|
-
|
|
509
|
+
* The path to the transaction logs directory.
|
|
510
|
+
*/
|
|
413
511
|
transactionLogsPath?: string;
|
|
414
512
|
/**
|
|
415
|
-
|
|
416
|
-
|
|
513
|
+
* Whether this store's column family participates in the VerificationTable.
|
|
514
|
+
*/
|
|
417
515
|
verificationTable?: boolean;
|
|
418
516
|
/**
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
517
|
+
* The per-column-family memtable size in bytes at which the memtable is
|
|
518
|
+
* sealed and flushed.
|
|
519
|
+
*/
|
|
422
520
|
writeBufferSize?: number;
|
|
423
521
|
/**
|
|
424
|
-
|
|
425
|
-
|
|
522
|
+
* The function used to encode keys using the shared `keyBuffer`.
|
|
523
|
+
*/
|
|
426
524
|
writeKey: WriteKeyFunction;
|
|
427
525
|
/**
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
526
|
+
* Initializes the store with a new `NativeDatabase` instance.
|
|
527
|
+
*
|
|
528
|
+
* @param path - The path to the database.
|
|
529
|
+
* @param options - The options for the store.
|
|
530
|
+
*/
|
|
433
531
|
constructor(path: string, options?: StoreOptions);
|
|
434
532
|
/**
|
|
435
|
-
|
|
436
|
-
|
|
533
|
+
* Closes the database.
|
|
534
|
+
*/
|
|
437
535
|
close(): void;
|
|
438
536
|
/**
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
537
|
+
* Claims this store for a `RocksDatabase`. A store is bound to a single
|
|
538
|
+
* database instance, so claiming a store that another `RocksDatabase` has
|
|
539
|
+
* already claimed throws. The claim is durable across close/reopen, so a
|
|
540
|
+
* store reused after its owner temporarily closed still throws.
|
|
541
|
+
*/
|
|
542
|
+
claim(): void;
|
|
543
|
+
/**
|
|
544
|
+
* Compacts the entire key range of the database asynchronously.
|
|
545
|
+
* This triggers manual compaction which removes tombstones and reclaims space.
|
|
546
|
+
*
|
|
547
|
+
* @example
|
|
548
|
+
* ```typescript
|
|
549
|
+
* const db = RocksDatabase.open('/path/to/database');
|
|
550
|
+
* await db.compact();
|
|
551
|
+
* ```
|
|
552
|
+
*/
|
|
448
553
|
compact(options?: CompactOptions): Promise<void>;
|
|
449
554
|
/**
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
555
|
+
* Creates a backup of the entire database (all column families) into the
|
|
556
|
+
* given directory and resolves with the new backup id. Parent directories
|
|
557
|
+
* are created as needed. See `backups` for restore and management.
|
|
558
|
+
*
|
|
559
|
+
* @example
|
|
560
|
+
* ```typescript
|
|
561
|
+
* const id = await db.backup('/path/to/backups');
|
|
562
|
+
* ```
|
|
563
|
+
*/
|
|
459
564
|
backup(backupDir: string, options?: BackupOptions): Promise<number>;
|
|
460
565
|
backup(stream: WritableStream<Uint8Array>, options?: BackupStreamOptions): Promise<void>;
|
|
461
566
|
/**
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
567
|
+
* Compacts the entire key range of the database synchronously.
|
|
568
|
+
* This triggers manual compaction which removes tombstones and reclaims space.
|
|
569
|
+
*
|
|
570
|
+
* @example
|
|
571
|
+
* ```typescript
|
|
572
|
+
* const db = RocksDatabase.open('/path/to/database');
|
|
573
|
+
* db.compactSync();
|
|
574
|
+
* ```
|
|
575
|
+
*/
|
|
471
576
|
compactSync(options?: CompactOptions): void;
|
|
472
577
|
/**
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
578
|
+
* Decodes a key from the database.
|
|
579
|
+
*
|
|
580
|
+
* @param key - The key to decode.
|
|
581
|
+
* @returns The decoded key.
|
|
582
|
+
*/
|
|
478
583
|
decodeKey(key: Buffer): Key;
|
|
479
584
|
/**
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
585
|
+
* Decodes a value from the database.
|
|
586
|
+
*
|
|
587
|
+
* @param value - The value to decode.
|
|
588
|
+
* @returns The decoded value.
|
|
589
|
+
*/
|
|
485
590
|
decodeValue(value: BufferWithDataView): any;
|
|
486
591
|
/**
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
592
|
+
* Encodes a key for the database.
|
|
593
|
+
*
|
|
594
|
+
* @param key - The key to encode.
|
|
595
|
+
* @returns The encoded key.
|
|
596
|
+
*/
|
|
492
597
|
encodeKey(key: Key): BufferWithDataView;
|
|
493
598
|
/**
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
599
|
+
* Encodes a value for the database.
|
|
600
|
+
*
|
|
601
|
+
* @param value - The value to encode.
|
|
602
|
+
* @returns The encoded value.
|
|
603
|
+
*/
|
|
499
604
|
encodeValue(value: any): BufferWithDataView | Uint8Array;
|
|
500
605
|
get(context: StoreContext, key: Key, alwaysCreateNewBuffer?: boolean, options?: StoreGetOptions): any | undefined;
|
|
501
606
|
getCount(context: StoreContext, options?: StoreRangeOptions): number;
|
|
@@ -504,118 +609,118 @@ declare class Store {
|
|
|
504
609
|
getRange(context: StoreContext, options?: StoreIteratorOptions): ExtendedIterable<DBIteratorValue<any>>;
|
|
505
610
|
getSync(context: StoreContext, key: Key, alwaysCreateNewBuffer?: boolean, options?: StoreGetOptions): any | undefined;
|
|
506
611
|
/**
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
612
|
+
* Checks if the data method options object contains a transaction ID and
|
|
613
|
+
* returns it.
|
|
614
|
+
*/
|
|
510
615
|
getTxnId(options?: DBITransactional | unknown): number | undefined;
|
|
511
616
|
/**
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
617
|
+
* Gets or creates a buffer that can be shared across worker threads.
|
|
618
|
+
*
|
|
619
|
+
* @param key - The key to get or create the buffer for.
|
|
620
|
+
* @param defaultBuffer - The default buffer to copy and use if the buffer
|
|
621
|
+
* does not exist.
|
|
622
|
+
* @param [options] - The options for the buffer.
|
|
623
|
+
* @param [options.callback] - A optional callback is called when `notify()`
|
|
624
|
+
* on the returned buffer is called.
|
|
625
|
+
* @returns An `ArrayBuffer` that is internally backed by a rocksdb-js
|
|
626
|
+
* managed buffer. The buffer also has `notify()` and `cancel()` methods
|
|
627
|
+
* that can be used to notify the specified `options.callback`.
|
|
628
|
+
*/
|
|
524
629
|
getUserSharedBuffer(key: Key, defaultBuffer: ArrayBuffer, options?: UserSharedBufferOptions): ArrayBufferWithNotify;
|
|
525
630
|
/**
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
631
|
+
* Checks if a lock exists.
|
|
632
|
+
* @param key The lock key.
|
|
633
|
+
* @returns `true` if the lock exists, `false` otherwise
|
|
634
|
+
*/
|
|
530
635
|
hasLock(key: Key): boolean;
|
|
531
636
|
/**
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
637
|
+
* Checks if the database is open.
|
|
638
|
+
*
|
|
639
|
+
* @returns `true` if the database is open, `false` otherwise.
|
|
640
|
+
*/
|
|
536
641
|
isOpen(): boolean;
|
|
537
642
|
/**
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
643
|
+
* Lists all transaction log names.
|
|
644
|
+
*
|
|
645
|
+
* @returns an array of transaction log names.
|
|
646
|
+
*/
|
|
542
647
|
listLogs(): string[];
|
|
543
648
|
/**
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
649
|
+
* Opens the database. This must be called before any database operations
|
|
650
|
+
* are performed.
|
|
651
|
+
*/
|
|
547
652
|
open(): boolean;
|
|
548
653
|
putSync(context: StoreContext, key: Key, value: any, options?: StorePutOptions): void;
|
|
549
654
|
removeSync(context: StoreContext, key: Key, options?: StoreRemoveOptions): void;
|
|
550
655
|
/**
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
656
|
+
* Attempts to acquire a lock for a given key. If the lock is available,
|
|
657
|
+
* the function returns `true` and the optional callback is never called.
|
|
658
|
+
* If the lock is not available, the function returns `false` and the
|
|
659
|
+
* callback is queued until the lock is released.
|
|
660
|
+
*
|
|
661
|
+
* @param key - The key to lock.
|
|
662
|
+
* @param onUnlocked - A callback to call when the lock is released.
|
|
663
|
+
* @returns `true` if the lock was acquired, `false` otherwise.
|
|
664
|
+
*/
|
|
560
665
|
tryLock(key: Key, onUnlocked?: () => void): boolean;
|
|
561
666
|
/**
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
667
|
+
* Releases the lock on the given key and calls any queued `onUnlocked`
|
|
668
|
+
* callback handlers.
|
|
669
|
+
*
|
|
670
|
+
* @param key - The key to unlock.
|
|
671
|
+
*/
|
|
567
672
|
unlock(key: Key): void;
|
|
568
673
|
/**
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
674
|
+
* Gets or creates a transaction log instance.
|
|
675
|
+
*
|
|
676
|
+
* @param context - The context to use for the transaction log.
|
|
677
|
+
* @param name - The name of the transaction log.
|
|
678
|
+
* @returns The transaction log.
|
|
679
|
+
*/
|
|
575
680
|
useLog(context: StoreContext, name: string | number): TransactionLog;
|
|
576
681
|
/**
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
682
|
+
* Checks the process-global verification table for a fresh version match
|
|
683
|
+
* on `key`. Returns `true` when the table currently records `version` for
|
|
684
|
+
* this database+column-family. Provides a fast cache-freshness check
|
|
685
|
+
* before falling back to a full read.
|
|
686
|
+
*/
|
|
582
687
|
verifyVersion(key: Key, version: number): boolean;
|
|
583
688
|
/**
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
689
|
+
* Seeds the verification-table slot for `key` with `version`. Has no
|
|
690
|
+
* effect if the slot is currently lock-tagged or the table is disabled.
|
|
691
|
+
* Useful after a full read where the caller already knows the version.
|
|
692
|
+
*/
|
|
588
693
|
populateVersion(key: Key, version: number): void;
|
|
589
694
|
/**
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
695
|
+
* Acquires a lock on the given key and calls the callback.
|
|
696
|
+
*
|
|
697
|
+
* @param key - The key to lock.
|
|
698
|
+
* @param callback - The callback to call when the lock is acquired.
|
|
699
|
+
* @returns A promise that resolves when the lock is acquired.
|
|
700
|
+
*/
|
|
596
701
|
withLock(key: Key, callback: () => void | Promise<void>): Promise<void>;
|
|
597
702
|
}
|
|
598
703
|
interface GetOptions {
|
|
599
704
|
/**
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
705
|
+
* When set, the native layer checks the verification table before reading.
|
|
706
|
+
* If the slot holds this version, returns `FRESH_VERSION_FLAG` immediately
|
|
707
|
+
* (the cached value is still valid). After a DB read, also seeds the slot
|
|
708
|
+
* with the version extracted from the value.
|
|
709
|
+
*/
|
|
605
710
|
expectedVersion?: number;
|
|
606
711
|
/**
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
712
|
+
* When `true`, after a DB read the native layer automatically seeds the
|
|
713
|
+
* verification-table slot with the version extracted from the value.
|
|
714
|
+
* Eliminates the need for a separate `populateVersion` call on cold reads.
|
|
715
|
+
*
|
|
716
|
+
* @default false
|
|
717
|
+
*/
|
|
613
718
|
populateVersion?: boolean;
|
|
614
719
|
/**
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
720
|
+
* Whether to skip decoding the value.
|
|
721
|
+
*
|
|
722
|
+
* @default false
|
|
723
|
+
*/
|
|
619
724
|
skipDecode?: boolean;
|
|
620
725
|
}
|
|
621
726
|
interface PutOptions {
|
|
@@ -627,55 +732,55 @@ interface PutOptions {
|
|
|
627
732
|
//#endregion
|
|
628
733
|
//#region src/transaction.d.ts
|
|
629
734
|
/**
|
|
630
|
-
* Sentinel value returned by `commit()` when `coordinatedRetry: true` and the
|
|
631
|
-
* transaction encountered an IsBusy conflict. The native layer parks on VT
|
|
632
|
-
* slots and resolves only after the conflicting transaction releases its write
|
|
633
|
-
* intent, so callers should retry immediately without any backoff delay.
|
|
634
|
-
*/
|
|
735
|
+
* Sentinel value returned by `commit()` when `coordinatedRetry: true` and the
|
|
736
|
+
* transaction encountered an IsBusy conflict. The native layer parks on VT
|
|
737
|
+
* slots and resolves only after the conflicting transaction releases its write
|
|
738
|
+
* intent, so callers should retry immediately without any backoff delay.
|
|
739
|
+
*/
|
|
635
740
|
declare const RETRY_NOW: number;
|
|
636
741
|
/**
|
|
637
|
-
* Provides transaction level operations to a transaction callback.
|
|
638
|
-
*/
|
|
742
|
+
* Provides transaction level operations to a transaction callback.
|
|
743
|
+
*/
|
|
639
744
|
declare class Transaction extends DBI {
|
|
640
745
|
#private;
|
|
641
746
|
/**
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
747
|
+
* Create a new transaction.
|
|
748
|
+
*
|
|
749
|
+
* @param store - The base store interface for this transaction.
|
|
750
|
+
* @param options - The options for the transaction.
|
|
751
|
+
*/
|
|
647
752
|
constructor(store: Store, options?: NativeTransactionOptions);
|
|
648
753
|
/**
|
|
649
|
-
|
|
650
|
-
|
|
754
|
+
* Abort the transaction.
|
|
755
|
+
*/
|
|
651
756
|
abort(): void;
|
|
652
757
|
/**
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
758
|
+
* Commit the transaction.
|
|
759
|
+
*
|
|
760
|
+
* Returns `RETRY_NOW` when `coordinatedRetry: true` and an IsBusy conflict
|
|
761
|
+
* was detected. The caller should retry the transaction body immediately.
|
|
762
|
+
*/
|
|
658
763
|
commit(): Promise<typeof RETRY_NOW | void>;
|
|
659
764
|
/**
|
|
660
|
-
|
|
661
|
-
|
|
765
|
+
* Commit the transaction synchronously.
|
|
766
|
+
*/
|
|
662
767
|
commitSync(): void;
|
|
663
768
|
/**
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
769
|
+
* Returns the transaction start timestamp in seconds. Defaults to the time at which
|
|
770
|
+
* the transaction was created.
|
|
771
|
+
*
|
|
772
|
+
* @returns The transaction start timestamp in seconds.
|
|
773
|
+
*/
|
|
669
774
|
getTimestamp(): number;
|
|
670
775
|
/**
|
|
671
|
-
|
|
672
|
-
|
|
776
|
+
* Get the transaction id.
|
|
777
|
+
*/
|
|
673
778
|
get id(): number;
|
|
674
779
|
/**
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
780
|
+
* Set the transaction start timestamp in seconds.
|
|
781
|
+
*
|
|
782
|
+
* @param timestamp - The timestamp to set in seconds.
|
|
783
|
+
*/
|
|
679
784
|
setTimestamp(timestamp?: number): void;
|
|
680
785
|
}
|
|
681
786
|
//#endregion
|
|
@@ -685,317 +790,317 @@ type MaybePromise<T> = T | Promise<T>;
|
|
|
685
790
|
//#region src/dbi.d.ts
|
|
686
791
|
interface RocksDBOptions {
|
|
687
792
|
/**
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
793
|
+
* When `true`, RocksDB will do some enhancements for prefetching the data.
|
|
794
|
+
* Defaults to `true`. Note that RocksDB defaults this to `false`.
|
|
795
|
+
*/
|
|
691
796
|
adaptiveReadahead?: boolean;
|
|
692
797
|
/**
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
798
|
+
* When `true`, RocksDB will prefetch some data async and apply it if reads
|
|
799
|
+
* are sequential and its internal automatic prefetching. Defaults to
|
|
800
|
+
* `true`. Note that RocksDB defaults this to `false`.
|
|
801
|
+
*/
|
|
697
802
|
asyncIO?: boolean;
|
|
698
803
|
/**
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
804
|
+
* When `true`, RocksDB will auto-tune the readahead size during scans
|
|
805
|
+
* internally based on the block cache data when block caching is enabled,
|
|
806
|
+
* an end key (e.g. upper bound) is set, and prefix is the same as the start
|
|
807
|
+
* key. Defaults to `true`.
|
|
808
|
+
*/
|
|
704
809
|
autoReadaheadSize?: boolean;
|
|
705
810
|
/**
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
811
|
+
* When `true`, after the iterator is closed, a background job is scheduled
|
|
812
|
+
* to flush the job queue and delete obsolete files. Defaults to `true`.
|
|
813
|
+
* Note that RocksDB defaults this to `false`.
|
|
814
|
+
*/
|
|
710
815
|
backgroundPurgeOnIteratorCleanup?: boolean;
|
|
711
816
|
/**
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
817
|
+
* When `true`, the iterator will fill the block cache. Filling the block
|
|
818
|
+
* cache is not desirable for bulk scans and could impact eviction order.
|
|
819
|
+
* Defaults to `false`. Note that RocksDB defaults this to `true`.
|
|
820
|
+
*/
|
|
716
821
|
fillCache?: boolean;
|
|
717
822
|
/**
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
823
|
+
* The RocksDB readahead size. RocksDB does auto-readahead for iterators
|
|
824
|
+
* when there is more than two reads for a table file. The readahead
|
|
825
|
+
* starts at 8KB and doubles on every additional read up to 256KB. This
|
|
826
|
+
* option can help if most of the range scans are large and if a larger
|
|
827
|
+
* readahead than that enabled by auto-readahead is needed. Using a large
|
|
828
|
+
* readahead size (> 2MB) can typically improve the performance of forward
|
|
829
|
+
* iteration on spinning disks. Defaults to `0`.
|
|
830
|
+
*/
|
|
726
831
|
readaheadSize?: number;
|
|
727
832
|
/**
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
833
|
+
* When `true`, creates a "tailing iterator" which is a special iterator
|
|
834
|
+
* that has a view of the complete database including newly added data and
|
|
835
|
+
* is optimized for sequential reads. This will return records that were
|
|
836
|
+
* inserted into the database after the creation of the iterator. Defaults
|
|
837
|
+
* to `false`.
|
|
838
|
+
*/
|
|
734
839
|
tailing?: boolean;
|
|
735
840
|
}
|
|
736
841
|
interface RangeOptions extends RocksDBOptions {
|
|
737
842
|
/**
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
843
|
+
* The range end key, otherwise known as the "upper bound". Defaults to
|
|
844
|
+
* the last key in the database.
|
|
845
|
+
*/
|
|
741
846
|
end?: Key | Uint8Array;
|
|
742
847
|
/**
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
848
|
+
* When `true`, the iterator will exclude the first key if it matches the start key.
|
|
849
|
+
* Defaults to `false`.
|
|
850
|
+
*/
|
|
746
851
|
exclusiveStart?: boolean;
|
|
747
852
|
/**
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
853
|
+
* When `true`, the iterator will include the last key if it matches the end
|
|
854
|
+
* key. Defaults to `false`.
|
|
855
|
+
*/
|
|
751
856
|
inclusiveEnd?: boolean;
|
|
752
857
|
/**
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
858
|
+
* The range start key, otherwise known as the "lower bound". Defaults to
|
|
859
|
+
* the first key in the database.
|
|
860
|
+
*/
|
|
756
861
|
start?: Key | Uint8Array;
|
|
757
862
|
}
|
|
758
863
|
interface IteratorOptions extends RangeOptions {
|
|
759
864
|
/**
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
865
|
+
* The maximum number of entries to yield. When set, iteration stops after
|
|
866
|
+
* `limit` entries regardless of the range bounds. Values <= 0 yield nothing.
|
|
867
|
+
* Unset means no limit.
|
|
868
|
+
*/
|
|
764
869
|
limit?: number;
|
|
765
870
|
/**
|
|
766
|
-
|
|
767
|
-
|
|
871
|
+
* A specific key to match which may result in zero, one, or many values.
|
|
872
|
+
*/
|
|
768
873
|
key?: Key;
|
|
769
874
|
/**
|
|
770
|
-
|
|
771
|
-
|
|
875
|
+
* When `true`, only returns the number of values for the given query.
|
|
876
|
+
*/
|
|
772
877
|
onlyCount?: boolean;
|
|
773
878
|
/**
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
879
|
+
* When `true`, the iterator will iterate in reverse order. Defaults to
|
|
880
|
+
* `false`.
|
|
881
|
+
*/
|
|
777
882
|
reverse?: boolean;
|
|
778
883
|
/**
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
884
|
+
* When `true`, decodes and returns the value. When `false`, the value is
|
|
885
|
+
* omitted. Defaults to `true`.
|
|
886
|
+
*/
|
|
782
887
|
values?: boolean;
|
|
783
888
|
/**
|
|
784
|
-
|
|
785
|
-
|
|
889
|
+
* When `true`, the iterator will only return the values.
|
|
890
|
+
*/
|
|
786
891
|
valuesOnly?: boolean;
|
|
787
892
|
}
|
|
788
893
|
interface DBITransactional {
|
|
789
894
|
transaction?: Transaction;
|
|
790
895
|
}
|
|
791
896
|
/**
|
|
792
|
-
* The base class for all database operations. This base class is shared by
|
|
793
|
-
* `RocksDatabase` and `Transaction`.
|
|
794
|
-
*
|
|
795
|
-
* This class is not meant to be used directly.
|
|
796
|
-
*/
|
|
897
|
+
* The base class for all database operations. This base class is shared by
|
|
898
|
+
* `RocksDatabase` and `Transaction`.
|
|
899
|
+
*
|
|
900
|
+
* This class is not meant to be used directly.
|
|
901
|
+
*/
|
|
797
902
|
declare class DBI<T extends DBITransactional | unknown = unknown> {
|
|
798
903
|
/**
|
|
799
|
-
|
|
800
|
-
|
|
904
|
+
* The RocksDB context for `get()`, `put()`, and `remove()`.
|
|
905
|
+
*/
|
|
801
906
|
_context: StoreContext;
|
|
802
907
|
/**
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
908
|
+
* The database store instance. The store instance is tied to the database
|
|
909
|
+
* instance and shared with transaction instances.
|
|
910
|
+
*/
|
|
806
911
|
store: Store;
|
|
807
912
|
/**
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
913
|
+
* Initializes the DBI context.
|
|
914
|
+
*
|
|
915
|
+
* @param store - The store instance.
|
|
916
|
+
* @param transaction - The transaction instance.
|
|
917
|
+
*/
|
|
813
918
|
constructor(store: Store, transaction?: NativeTransaction);
|
|
814
919
|
/**
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
920
|
+
* Adds a listener for the given key.
|
|
921
|
+
*
|
|
922
|
+
* @param event - The event name to add the listener for.
|
|
923
|
+
* @param callback - The callback to add.
|
|
924
|
+
*/
|
|
820
925
|
addListener(event: string, callback: (...args: any[]) => void): this;
|
|
821
926
|
/**
|
|
822
|
-
|
|
823
|
-
|
|
927
|
+
* Retrieves the value for the given key, then returns the decoded value.
|
|
928
|
+
*/
|
|
824
929
|
get(key: Key, options?: GetOptions & T): MaybePromise<any | undefined>;
|
|
825
930
|
/**
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
931
|
+
* Retrieves the binary data for the given key. This is just like `get()`,
|
|
932
|
+
* but bypasses the decoder.
|
|
933
|
+
*
|
|
934
|
+
* Note: Used by HDBreplication.
|
|
935
|
+
*/
|
|
831
936
|
getBinary(key: Key, options?: GetOptions & T): MaybePromise<Buffer | number | undefined>;
|
|
832
937
|
/**
|
|
833
|
-
|
|
834
|
-
|
|
938
|
+
* Synchronously retrieves the binary data for the given key.
|
|
939
|
+
*/
|
|
835
940
|
getBinarySync(key: Key, options?: GetOptions & T): Buffer | number | undefined;
|
|
836
941
|
/**
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
942
|
+
* Retrieves the binary data for the given key using a preallocated,
|
|
943
|
+
* reusable buffer. Data in the buffer is only valid until the next get
|
|
944
|
+
* operation (including cursor operations).
|
|
945
|
+
*
|
|
946
|
+
* Note: The reusable buffer slightly differs from a typical buffer:
|
|
947
|
+
* - `.length` is set to the size of the value
|
|
948
|
+
* - `.byteLength` is set to the size of the full allocated memory area for
|
|
949
|
+
* the buffer (usually much larger).
|
|
950
|
+
*/
|
|
846
951
|
getBinaryFast(key: Key, options?: GetOptions & T): MaybePromise<Buffer | number | undefined>;
|
|
847
952
|
/**
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
953
|
+
* Synchronously retrieves the binary data for the given key using a
|
|
954
|
+
* preallocated, reusable buffer. Data in the buffer is only valid until the
|
|
955
|
+
* next get operation (including cursor operations).
|
|
956
|
+
*/
|
|
852
957
|
getBinaryFastSync(key: Key, options?: GetOptions & T): Buffer | number | undefined;
|
|
853
958
|
/**
|
|
854
|
-
|
|
855
|
-
|
|
959
|
+
* Retrieves all keys within a range.
|
|
960
|
+
*/
|
|
856
961
|
getKeys(options?: IteratorOptions & T): any | undefined;
|
|
857
962
|
/**
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
963
|
+
* Retrieves the number of keys within a range.
|
|
964
|
+
*
|
|
965
|
+
* @param options - The range options.
|
|
966
|
+
* @returns The number of keys within the range.
|
|
967
|
+
*
|
|
968
|
+
* @example
|
|
969
|
+
* ```typescript
|
|
970
|
+
* const total = db.getKeysCount();
|
|
971
|
+
* const range = db.getKeysCount({ start: 'a', end: 'z' });
|
|
972
|
+
* ```
|
|
973
|
+
*/
|
|
869
974
|
getKeysCount(options?: RangeOptions & T): number;
|
|
870
975
|
/**
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
976
|
+
* Retrieves a range of keys and their values.
|
|
977
|
+
*
|
|
978
|
+
* @param options - The iterator options.
|
|
979
|
+
* @returns A range iterable.
|
|
980
|
+
*
|
|
981
|
+
* @example
|
|
982
|
+
* ```typescript
|
|
983
|
+
* for (const { key, value } of db.getRange()) {
|
|
984
|
+
* console.log({ key, value });
|
|
985
|
+
* }
|
|
986
|
+
*
|
|
987
|
+
* for (const { key, value } of db.getRange({ start: 'a', end: 'z' })) {
|
|
988
|
+
* console.log({ key, value });
|
|
989
|
+
* }
|
|
990
|
+
* ```
|
|
991
|
+
*/
|
|
887
992
|
getRange(options?: IteratorOptions & T): any | undefined;
|
|
888
993
|
/**
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
994
|
+
* Synchronously retrieves the value for the given key, then returns the
|
|
995
|
+
* decoded value.
|
|
996
|
+
*/
|
|
892
997
|
getSync(key: Key, options?: GetOptions & T): any | undefined;
|
|
893
998
|
/**
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
999
|
+
* Gets the number of listeners for the given key.
|
|
1000
|
+
*
|
|
1001
|
+
* @param event - The event name to get the listeners for.
|
|
1002
|
+
* @returns The number of listeners for the given key.
|
|
1003
|
+
*/
|
|
899
1004
|
listeners(event: string | BufferWithDataView): number;
|
|
900
1005
|
/**
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
1006
|
+
* Notifies an event for the given key.
|
|
1007
|
+
*
|
|
1008
|
+
* @param event - The event name to emit the event for.
|
|
1009
|
+
* @param args - The arguments to emit.
|
|
1010
|
+
* @returns `true` if there were listeners, `false` otherwise.
|
|
1011
|
+
*/
|
|
907
1012
|
notify(event: string, ...args: any[]): boolean;
|
|
908
1013
|
/**
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
1014
|
+
* Alias for `removeListener()`.
|
|
1015
|
+
*
|
|
1016
|
+
* @param event - The event name to remove the listener for.
|
|
1017
|
+
* @param callback - The callback to remove.
|
|
1018
|
+
*/
|
|
914
1019
|
off(event: string, callback: (...args: any[]) => void): this;
|
|
915
1020
|
/**
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
1021
|
+
* Alias for `addListener()`.
|
|
1022
|
+
*
|
|
1023
|
+
* @param event - The event name to add the listener for.
|
|
1024
|
+
* @param callback - The callback to add.
|
|
1025
|
+
*/
|
|
921
1026
|
on(event: string, callback: (...args: any[]) => void): this;
|
|
922
1027
|
/**
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
1028
|
+
* Adds a one-time listener, then automatically removes it.
|
|
1029
|
+
*
|
|
1030
|
+
* @param event - The event name to add the listener for.
|
|
1031
|
+
* @param callback - The callback to add.
|
|
1032
|
+
*/
|
|
928
1033
|
once(event: string, callback: (...args: any[]) => void): this;
|
|
929
1034
|
/**
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
1035
|
+
* Stores a value for the given key.
|
|
1036
|
+
*
|
|
1037
|
+
* @param key - The key to store the value for.
|
|
1038
|
+
* @param value - The value to store.
|
|
1039
|
+
* @param options - The put options.
|
|
1040
|
+
* @returns The key and value.
|
|
1041
|
+
*
|
|
1042
|
+
* @example
|
|
1043
|
+
* ```typescript
|
|
1044
|
+
* await db.put('a', 'b');
|
|
1045
|
+
* ```
|
|
1046
|
+
*/
|
|
942
1047
|
put(key: Key, value: any, options?: PutOptions & T): Promise<void>;
|
|
943
1048
|
/**
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
1049
|
+
* Synchronously stores a value for the given key.
|
|
1050
|
+
*
|
|
1051
|
+
* @param key - The key to store the value for.
|
|
1052
|
+
* @param value - The value to store.
|
|
1053
|
+
* @param options - The put options.
|
|
1054
|
+
* @returns The key and value.
|
|
1055
|
+
*
|
|
1056
|
+
* @example
|
|
1057
|
+
* ```typescript
|
|
1058
|
+
* db.putSync('a', 'b');
|
|
1059
|
+
* ```
|
|
1060
|
+
*/
|
|
956
1061
|
putSync(key: Key, value: any, options?: PutOptions & T): void;
|
|
957
1062
|
/**
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
1063
|
+
* Removes a value for the given key. If the key does not exist, it will
|
|
1064
|
+
* not error.
|
|
1065
|
+
*
|
|
1066
|
+
* @param key - The key to remove the value for.
|
|
1067
|
+
* @param options - The remove options.
|
|
1068
|
+
* @returns The key and value.
|
|
1069
|
+
*
|
|
1070
|
+
* @example
|
|
1071
|
+
* ```typescript
|
|
1072
|
+
* await db.remove('a');
|
|
1073
|
+
* ```
|
|
1074
|
+
*/
|
|
970
1075
|
remove(key: Key, options?: T): Promise<void>;
|
|
971
1076
|
/**
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
1077
|
+
* Removes a value for the given key. If the key does not exist, it will
|
|
1078
|
+
* not error.
|
|
1079
|
+
*
|
|
1080
|
+
* @param key - The key to remove the value for.
|
|
1081
|
+
* @param options - The remove options.
|
|
1082
|
+
* @returns The key and value.
|
|
1083
|
+
*
|
|
1084
|
+
* @example
|
|
1085
|
+
* ```typescript
|
|
1086
|
+
* db.removeSync('a');
|
|
1087
|
+
* ```
|
|
1088
|
+
*/
|
|
984
1089
|
removeSync(key: Key, options?: T): void;
|
|
985
1090
|
/**
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
1091
|
+
* Removes an event listener. You must specify the exact same callback that was
|
|
1092
|
+
* used in `addListener()`.
|
|
1093
|
+
*
|
|
1094
|
+
* @param event - The event name to remove the listener for.
|
|
1095
|
+
* @param callback - The callback to remove.
|
|
1096
|
+
*/
|
|
992
1097
|
removeListener(event: string, callback: (value?: any) => void): boolean;
|
|
993
1098
|
/**
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
1099
|
+
* Get or create a transaction log instance.
|
|
1100
|
+
*
|
|
1101
|
+
* @param name - The name of the transaction log.
|
|
1102
|
+
* @returns The transaction log.
|
|
1103
|
+
*/
|
|
999
1104
|
useLog(name: string | number): TransactionLog;
|
|
1000
1105
|
}
|
|
1001
1106
|
//#endregion
|
|
@@ -1049,6 +1154,8 @@ type StatsBasics = {
|
|
|
1049
1154
|
"txnlog.transactionsWritten": number;
|
|
1050
1155
|
"txnlog.bytesWritten": number;
|
|
1051
1156
|
"txnlog.replayGapBytes": number;
|
|
1157
|
+
"commitPipeline.logQueueDepth": number;
|
|
1158
|
+
"commitPipeline.commitQueueDepth": number;
|
|
1052
1159
|
};
|
|
1053
1160
|
type StatsCuratedExtras = {
|
|
1054
1161
|
"rocksdb.block.cache.hit": number;
|
|
@@ -1367,24 +1474,132 @@ interface GetStatsMethod {
|
|
|
1367
1474
|
getStats(all: true): StatsAll;
|
|
1368
1475
|
}
|
|
1369
1476
|
//#endregion
|
|
1477
|
+
//#region src/validate-transaction-log.d.ts
|
|
1478
|
+
/**
|
|
1479
|
+
* The validation result for a single transaction log file within a store, as
|
|
1480
|
+
* returned by {@link validateTransactionLogStore}.
|
|
1481
|
+
*/
|
|
1482
|
+
interface TransactionLogFileValidation {
|
|
1483
|
+
/** File name relative to the store directory, e.g. `"3.txnlog"`. */
|
|
1484
|
+
file: string;
|
|
1485
|
+
/** Sequence number parsed from the file name. */
|
|
1486
|
+
sequence: number;
|
|
1487
|
+
/** On-disk file size in bytes. */
|
|
1488
|
+
size: number;
|
|
1489
|
+
/** Number of well-formed entry frames. */
|
|
1490
|
+
entries: number;
|
|
1491
|
+
/** End offset of the validly framed data (header + well-formed entries). */
|
|
1492
|
+
validBytes: number;
|
|
1493
|
+
/** `true` when `errors` is empty. */
|
|
1494
|
+
valid: boolean;
|
|
1495
|
+
/**
|
|
1496
|
+
* Conditions that make the file invalid: a bad/missing header, an
|
|
1497
|
+
* unsupported version, or a mid-file framing break. With `strict`, a torn
|
|
1498
|
+
* tail is also reported here.
|
|
1499
|
+
*/
|
|
1500
|
+
errors: string[];
|
|
1501
|
+
/**
|
|
1502
|
+
* Conditions that do not invalidate the file: a torn tail (recoverable —
|
|
1503
|
+
* open-time recovery truncates it without losing committed entries) and
|
|
1504
|
+
* per-entry anomalies such as suspicious timestamps or undefined flag bits.
|
|
1505
|
+
*/
|
|
1506
|
+
warnings: string[];
|
|
1507
|
+
}
|
|
1508
|
+
/**
|
|
1509
|
+
* The result of validating a transaction log store directory, as returned by
|
|
1510
|
+
* {@link validateTransactionLogStore}.
|
|
1511
|
+
*/
|
|
1512
|
+
interface TransactionLogStoreValidation {
|
|
1513
|
+
/** The validated store directory. */
|
|
1514
|
+
path: string;
|
|
1515
|
+
/**
|
|
1516
|
+
* `true` when there are no store-level errors and every log file is valid.
|
|
1517
|
+
*/
|
|
1518
|
+
valid: boolean;
|
|
1519
|
+
/** Per-file validation results, ordered by sequence number. */
|
|
1520
|
+
files: TransactionLogFileValidation[];
|
|
1521
|
+
/**
|
|
1522
|
+
* Store-level errors: malformed file names, an unreadable file, or a
|
|
1523
|
+
* corrupt `txn.state`.
|
|
1524
|
+
*/
|
|
1525
|
+
errors: string[];
|
|
1526
|
+
/**
|
|
1527
|
+
* Store-level warnings: sequence gaps, unexpected directory entries, or an
|
|
1528
|
+
* implausible `txn.state` flushed position.
|
|
1529
|
+
*/
|
|
1530
|
+
warnings: string[];
|
|
1531
|
+
}
|
|
1532
|
+
/**
|
|
1533
|
+
* Options for {@link validateTransactionLogStore}.
|
|
1534
|
+
*/
|
|
1535
|
+
interface ValidateTransactionLogStoreOptions {
|
|
1536
|
+
/**
|
|
1537
|
+
* Report conditions that indicate an incomplete snapshot — a torn tail, a
|
|
1538
|
+
* sequence gap, or a `txn.state` flushed position beyond the newest log
|
|
1539
|
+
* file or beyond its file's actual size — as errors instead of warnings. A
|
|
1540
|
+
* torn tail on a live store is a normal crash artifact that open-time
|
|
1541
|
+
* recovery truncates, but a backup snapshot captures every surviving file
|
|
1542
|
+
* on committed entry boundaries and must be clean end to end —
|
|
1543
|
+
* `backups.verify()` validates snapshots with `strict: true`. Defaults to
|
|
1544
|
+
* `false`.
|
|
1545
|
+
*/
|
|
1546
|
+
strict?: boolean;
|
|
1547
|
+
}
|
|
1548
|
+
/**
|
|
1549
|
+
* Validates a transaction log store directory: every `<sequence>.txnlog` file
|
|
1550
|
+
* is checked for a valid header (token, version) and intact v1 entry framing
|
|
1551
|
+
* (using the same scan as open-time crash recovery), file-name and sequence
|
|
1552
|
+
* continuity are checked, and the `txn.state` side file (when present) is
|
|
1553
|
+
* checked for shape and a plausible flushed position. The result reports
|
|
1554
|
+
* per-file entry counts, errors, and warnings; it does not throw when the
|
|
1555
|
+
* store is invalid — check `result.valid`.
|
|
1556
|
+
*
|
|
1557
|
+
* Runs entirely in native code on a worker thread and does not require (or
|
|
1558
|
+
* open) a database, so it works on the store of a closed database and on the
|
|
1559
|
+
* per-backup snapshots under `<backupDir>/transaction_logs/<backupId>/` alike.
|
|
1560
|
+
*
|
|
1561
|
+
* Validating a store that is being actively appended to can spuriously report
|
|
1562
|
+
* a torn tail for the current log file — the tail of an in-flight append is
|
|
1563
|
+
* indistinguishable from a crash artifact.
|
|
1564
|
+
*
|
|
1565
|
+
* Rejects if `path` does not exist or is not a directory (a bad argument, as
|
|
1566
|
+
* opposed to an invalid store).
|
|
1567
|
+
*
|
|
1568
|
+
* @param path The store directory, e.g. `<dbDir>/transaction_logs/<name>`.
|
|
1569
|
+
* @param options Validation options.
|
|
1570
|
+
*
|
|
1571
|
+
* @example
|
|
1572
|
+
* ```typescript
|
|
1573
|
+
* import { validateTransactionLogStore } from '@harperfast/rocksdb-js';
|
|
1574
|
+
*
|
|
1575
|
+
* const result = await validateTransactionLogStore('/path/to/db/transaction_logs/mylog');
|
|
1576
|
+
* if (!result.valid) {
|
|
1577
|
+
* for (const file of result.files) {
|
|
1578
|
+
* console.error(file.file, file.errors);
|
|
1579
|
+
* }
|
|
1580
|
+
* }
|
|
1581
|
+
* ```
|
|
1582
|
+
*/
|
|
1583
|
+
declare function validateTransactionLogStore(path: string, options?: ValidateTransactionLogStoreOptions): Promise<TransactionLogStoreValidation>;
|
|
1584
|
+
//#endregion
|
|
1370
1585
|
//#region src/load-binding.d.ts
|
|
1371
1586
|
type NativeTransactionOptions = {
|
|
1372
1587
|
/**
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1588
|
+
* Whether to disable snapshots.
|
|
1589
|
+
*
|
|
1590
|
+
* @default false
|
|
1591
|
+
*/
|
|
1377
1592
|
disableSnapshot?: boolean;
|
|
1378
1593
|
/**
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1594
|
+
* When `true`, an `IsBusy` conflict at commit time is resolved with the
|
|
1595
|
+
* `RETRY_NOW` sentinel value instead of being rejected. The native layer
|
|
1596
|
+
* may park on a VT slot before resolving, so the JS retry fires only after
|
|
1597
|
+
* the conflicting transaction has committed and released its write intent.
|
|
1598
|
+
*
|
|
1599
|
+
* Use together with `verificationTable: true` on the database.
|
|
1600
|
+
*
|
|
1601
|
+
* @default false
|
|
1602
|
+
*/
|
|
1388
1603
|
coordinatedRetry?: boolean;
|
|
1389
1604
|
};
|
|
1390
1605
|
type NativeTransaction = {
|
|
@@ -1421,23 +1636,23 @@ type TransactionEntry = {
|
|
|
1421
1636
|
endTxn: boolean;
|
|
1422
1637
|
};
|
|
1423
1638
|
/**
|
|
1424
|
-
* A position within a transaction log, identifying a log file by its sequence
|
|
1425
|
-
* number and a byte `offset` within that file.
|
|
1426
|
-
*/
|
|
1639
|
+
* A position within a transaction log, identifying a log file by its sequence
|
|
1640
|
+
* number and a byte `offset` within that file.
|
|
1641
|
+
*/
|
|
1427
1642
|
type TransactionLogPosition = {
|
|
1428
1643
|
sequence: number;
|
|
1429
1644
|
offset: number;
|
|
1430
1645
|
};
|
|
1431
1646
|
/**
|
|
1432
|
-
* A detailed statistics snapshot for a single transaction log store, returned
|
|
1433
|
-
* by {@link TransactionLog.getStats}. All sizes are in bytes; timestamps are
|
|
1434
|
-
* milliseconds since the Unix epoch.
|
|
1435
|
-
*
|
|
1436
|
-
* Memory note: `memory.mappedBytes` is virtual address space — the active write
|
|
1437
|
-
* file is mapped at the full configured `maxFileSize` on POSIX, so it does not
|
|
1438
|
-
* reflect resident memory. `memory.overlayBytes` (POSIX only; 0 on Windows) is
|
|
1439
|
-
* the file-backed portion and is the closer proxy for real consumption.
|
|
1440
|
-
*/
|
|
1647
|
+
* A detailed statistics snapshot for a single transaction log store, returned
|
|
1648
|
+
* by {@link TransactionLog.getStats}. All sizes are in bytes; timestamps are
|
|
1649
|
+
* milliseconds since the Unix epoch.
|
|
1650
|
+
*
|
|
1651
|
+
* Memory note: `memory.mappedBytes` is virtual address space — the active write
|
|
1652
|
+
* file is mapped at the full configured `maxFileSize` on POSIX, so it does not
|
|
1653
|
+
* reflect resident memory. `memory.overlayBytes` (POSIX only; 0 on Windows) is
|
|
1654
|
+
* the file-backed portion and is the closer proxy for real consumption.
|
|
1655
|
+
*/
|
|
1441
1656
|
type TransactionLogStats = {
|
|
1442
1657
|
name: string;
|
|
1443
1658
|
path: string;
|
|
@@ -1497,10 +1712,10 @@ type TransactionLog = {
|
|
|
1497
1712
|
_logBuffers: Map<number, WeakRef<LogBuffer>>;
|
|
1498
1713
|
};
|
|
1499
1714
|
/**
|
|
1500
|
-
* Shape of options that can be passed to the native iterator constructor for
|
|
1501
|
-
* the rare case of advanced RocksDB ReadOptions overrides. Common iterator
|
|
1502
|
-
* options are passed via the bitmask `flags` argument instead.
|
|
1503
|
-
*/
|
|
1715
|
+
* Shape of options that can be passed to the native iterator constructor for
|
|
1716
|
+
* the rare case of advanced RocksDB ReadOptions overrides. Common iterator
|
|
1717
|
+
* options are passed via the bitmask `flags` argument instead.
|
|
1718
|
+
*/
|
|
1504
1719
|
type NativeIteratorAdvancedOptions = {
|
|
1505
1720
|
adaptiveReadahead?: boolean;
|
|
1506
1721
|
asyncIO?: boolean;
|
|
@@ -1511,11 +1726,11 @@ type NativeIteratorAdvancedOptions = {
|
|
|
1511
1726
|
tailing?: boolean;
|
|
1512
1727
|
};
|
|
1513
1728
|
/**
|
|
1514
|
-
* The result of a single native iterator step. A number value matches one of
|
|
1515
|
-
* the `ITERATOR_RESULT_*` constants. The slow-path object is returned when
|
|
1516
|
-
* the data does not fit in the shared key/value buffers, or when the decoder
|
|
1517
|
-
* needs a stable value buffer.
|
|
1518
|
-
*/
|
|
1729
|
+
* The result of a single native iterator step. A number value matches one of
|
|
1730
|
+
* the `ITERATOR_RESULT_*` constants. The slow-path object is returned when
|
|
1731
|
+
* the data does not fit in the shared key/value buffers, or when the decoder
|
|
1732
|
+
* needs a stable value buffer.
|
|
1733
|
+
*/
|
|
1519
1734
|
type NativeIteratorResult = number | {
|
|
1520
1735
|
key: Buffer;
|
|
1521
1736
|
value?: Buffer;
|
|
@@ -1528,9 +1743,22 @@ declare class NativeIteratorCls {
|
|
|
1528
1743
|
}
|
|
1529
1744
|
type NativeDatabaseMode = "optimistic" | "pessimistic";
|
|
1530
1745
|
type NativeDatabaseOptions = {
|
|
1746
|
+
/**
|
|
1747
|
+
* The friendly name of a compression algorithm compiled into this RocksDB
|
|
1748
|
+
* build (see `supportedCompression`), e.g. `'lz4'`, `'zstd'`, `'none'`. The
|
|
1749
|
+
* higher-level `StoreOptions.compression` (which also accepts an object with
|
|
1750
|
+
* a level) is normalized down to this string plus `compressionLevel`.
|
|
1751
|
+
*/
|
|
1752
|
+
compression?: string;
|
|
1753
|
+
/**
|
|
1754
|
+
* Compression level forwarded to RocksDB's `compression_opts.level`. Meaning
|
|
1755
|
+
* is algorithm-specific; omit to use the algorithm's default.
|
|
1756
|
+
*/
|
|
1757
|
+
compressionLevel?: number;
|
|
1531
1758
|
dbWriteBufferSize?: number;
|
|
1532
1759
|
disableWAL?: boolean;
|
|
1533
1760
|
enableStats?: boolean;
|
|
1761
|
+
maxOpenFiles?: number;
|
|
1534
1762
|
maxWriteBufferNumber?: number;
|
|
1535
1763
|
maxWriteBufferSizeToMaintain?: number;
|
|
1536
1764
|
mode?: NativeDatabaseMode;
|
|
@@ -1544,11 +1772,11 @@ type NativeDatabaseOptions = {
|
|
|
1544
1772
|
transactionLogRetentionMs?: number;
|
|
1545
1773
|
transactionLogsPath?: string;
|
|
1546
1774
|
/**
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1775
|
+
* When true, transaction writes to this column family invalidate the
|
|
1776
|
+
* VerificationTable slot for each written key at write time (not at
|
|
1777
|
+
* commit time). Enable only for column families whose records are
|
|
1778
|
+
* cached (e.g. the primary CF of a table). Default: false.
|
|
1779
|
+
*/
|
|
1552
1780
|
verificationTable?: boolean;
|
|
1553
1781
|
writeBufferSize?: number;
|
|
1554
1782
|
};
|
|
@@ -1559,16 +1787,16 @@ type PurgeLogsOptions = {
|
|
|
1559
1787
|
before?: number;
|
|
1560
1788
|
destroy?: boolean;
|
|
1561
1789
|
/**
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1790
|
+
* When `true`, count the entries in each purged log file (extra work) and
|
|
1791
|
+
* return `PurgedLog[]` instead of the default `string[]` of file paths.
|
|
1792
|
+
*/
|
|
1565
1793
|
includeEntryCounts?: boolean;
|
|
1566
1794
|
name?: string;
|
|
1567
1795
|
};
|
|
1568
1796
|
/**
|
|
1569
|
-
* A purged transaction log file and the number of entries it held, returned by
|
|
1570
|
-
* `purgeLogs()` when `includeEntryCounts` is `true`.
|
|
1571
|
-
*/
|
|
1797
|
+
* A purged transaction log file and the number of entries it held, returned by
|
|
1798
|
+
* `purgeLogs()` when `includeEntryCounts` is `true`.
|
|
1799
|
+
*/
|
|
1572
1800
|
type PurgedLog = {
|
|
1573
1801
|
path: string;
|
|
1574
1802
|
entries: number;
|
|
@@ -1595,6 +1823,10 @@ type NativeDatabase = {
|
|
|
1595
1823
|
flushSync(): void;
|
|
1596
1824
|
notify(event: string | BufferWithDataView, args?: any[]): boolean;
|
|
1597
1825
|
get(keyLengthOrKeyBuffer: number | Buffer, resolve: ResolveCallback<Buffer | number>, reject: RejectCallback, txnId?: number, expectedVersion?: number): number;
|
|
1826
|
+
getCompression(): {
|
|
1827
|
+
algorithm: string;
|
|
1828
|
+
level?: number;
|
|
1829
|
+
};
|
|
1598
1830
|
getCount(options?: RangeOptions, txnId?: number): number;
|
|
1599
1831
|
getDBIntProperty(propertyName: string): number | undefined;
|
|
1600
1832
|
getDBProperty(propertyName: string): string | undefined;
|
|
@@ -1633,47 +1865,47 @@ type NativeDatabase = {
|
|
|
1633
1865
|
type RocksDatabaseConfig = {
|
|
1634
1866
|
blockCacheSize?: number;
|
|
1635
1867
|
/**
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1868
|
+
* Number of slots in the process-global verification table. Each slot is
|
|
1869
|
+
* 8 bytes; the default of 128K slots is 1 MB. Set to 0 to disable.
|
|
1870
|
+
*
|
|
1871
|
+
* Must be configured before the first database is opened. Once the table
|
|
1872
|
+
* is materialized, attempts to change this value will throw.
|
|
1873
|
+
*/
|
|
1642
1874
|
verificationTableEntries?: number;
|
|
1643
1875
|
compactOnClose?: boolean;
|
|
1644
1876
|
/**
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1877
|
+
* Total memtable memory limit (bytes) shared across every database opened
|
|
1878
|
+
* in this process. When set, RocksDB uses a single `WriteBufferManager` so
|
|
1879
|
+
* write buffers are bounded process-wide rather than per database. 0 (the
|
|
1880
|
+
* default) disables the manager.
|
|
1881
|
+
*
|
|
1882
|
+
* Can be updated at runtime; the new size takes effect on the existing
|
|
1883
|
+
* manager via `SetBufferSize`.
|
|
1884
|
+
*/
|
|
1653
1885
|
writeBufferManagerSize?: number;
|
|
1654
1886
|
/**
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1887
|
+
* When `true`, memtable memory is "charged" against the shared block cache
|
|
1888
|
+
* so the block cache and write buffers draw from a single pool. During
|
|
1889
|
+
* write bursts the cache shrinks to make room for memtables; once
|
|
1890
|
+
* memtables flush, the cache can grow back into the reclaimed space.
|
|
1891
|
+
*
|
|
1892
|
+
* Has no effect when the block cache is disabled (size 0) or
|
|
1893
|
+
* `writeBufferManagerSize` is 0. Must be set on the same `config()` call
|
|
1894
|
+
* that first enables the manager — changing it after the manager has been
|
|
1895
|
+
* created has no effect on the running instance.
|
|
1896
|
+
*
|
|
1897
|
+
* @default false
|
|
1898
|
+
*/
|
|
1667
1899
|
writeBufferManagerCostToCache?: boolean;
|
|
1668
1900
|
/**
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1901
|
+
* When `true`, writes are stalled once the manager's `buffer_size` is
|
|
1902
|
+
* exceeded, providing a hard cap on memtable memory. When `false`,
|
|
1903
|
+
* memtables are allowed to grow past the limit and flushes are simply
|
|
1904
|
+
* scheduled more aggressively. Off by default to favor write throughput
|
|
1905
|
+
* over hard memory bounding.
|
|
1906
|
+
*
|
|
1907
|
+
* @default false
|
|
1908
|
+
*/
|
|
1677
1909
|
writeBufferManagerAllowStall?: boolean;
|
|
1678
1910
|
};
|
|
1679
1911
|
type RegistryStatusDB = {
|
|
@@ -1694,10 +1926,10 @@ declare const constants: {
|
|
|
1694
1926
|
POPULATE_VERSION_FLAG: number;
|
|
1695
1927
|
FRESH_VERSION_FLAG: number;
|
|
1696
1928
|
/**
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1929
|
+
* Sentinel value resolved (not rejected) by `commit()` when
|
|
1930
|
+
* `coordinatedRetry: true` and the transaction encountered an IsBusy
|
|
1931
|
+
* conflict. JS should retry the transaction body immediately.
|
|
1932
|
+
*/
|
|
1701
1933
|
RETRY_NOW_VALUE: number;
|
|
1702
1934
|
TRANSACTION_LOG_TOKEN: number;
|
|
1703
1935
|
TRANSACTION_LOG_ENTRY_HEADER_SIZE: number;
|
|
@@ -1711,6 +1943,15 @@ declare const constants: {
|
|
|
1711
1943
|
ITERATOR_RESULT_DONE: number;
|
|
1712
1944
|
ITERATOR_RESULT_FAST: number;
|
|
1713
1945
|
};
|
|
1946
|
+
/**
|
|
1947
|
+
* The friendly names of every compression algorithm compiled into the loaded
|
|
1948
|
+
* RocksDB native binding, e.g. `['none', 'snappy', 'lz4', 'zstd']`. The set is
|
|
1949
|
+
* fixed for a given binary (it depends on which compression libraries RocksDB
|
|
1950
|
+
* was linked against), so this is a static list. `'none'` (no compression) is
|
|
1951
|
+
* always present. Use it to validate a `compression` option or to pick an
|
|
1952
|
+
* algorithm that is actually available at runtime.
|
|
1953
|
+
*/
|
|
1954
|
+
declare const supportedCompression: readonly string[];
|
|
1714
1955
|
declare const NativeDatabase: NativeDatabase;
|
|
1715
1956
|
declare const NativeTransaction: NativeTransaction;
|
|
1716
1957
|
declare const TransactionLog: TransactionLog;
|
|
@@ -1718,36 +1959,38 @@ declare const registryStatus: () => RegistryStatus;
|
|
|
1718
1959
|
declare const shutdown: () => void;
|
|
1719
1960
|
declare const currentThreadId: () => number;
|
|
1720
1961
|
/**
|
|
1721
|
-
* Advises the kernel that the file-backed pages of every mapped transaction log
|
|
1722
|
-
* are cold (Linux MADV_COLD), so they are reclaimed first under memory pressure
|
|
1723
|
-
* without being freed — useful during replication catch-up, where a full read of
|
|
1724
|
-
* the logs would otherwise inflate the container's reclaimable cache toward its
|
|
1725
|
-
* cgroup limit. No-op on kernels < 5.4, macOS, and Windows.
|
|
1726
|
-
*
|
|
1727
|
-
* The transaction log registry is a process-global singleton shared across all
|
|
1728
|
-
* worker threads, so a single call cools every worker's maps. Call it on an
|
|
1729
|
-
* interval from one thread (e.g. an `unref()`ed timer on the main thread).
|
|
1730
|
-
*
|
|
1731
|
-
* @returns the number of maps cooled and total file-backed bytes advised.
|
|
1732
|
-
*/
|
|
1962
|
+
* Advises the kernel that the file-backed pages of every mapped transaction log
|
|
1963
|
+
* are cold (Linux MADV_COLD), so they are reclaimed first under memory pressure
|
|
1964
|
+
* without being freed — useful during replication catch-up, where a full read of
|
|
1965
|
+
* the logs would otherwise inflate the container's reclaimable cache toward its
|
|
1966
|
+
* cgroup limit. No-op on kernels < 5.4, macOS, and Windows.
|
|
1967
|
+
*
|
|
1968
|
+
* The transaction log registry is a process-global singleton shared across all
|
|
1969
|
+
* worker threads, so a single call cools every worker's maps. Call it on an
|
|
1970
|
+
* interval from one thread (e.g. an `unref()`ed timer on the main thread).
|
|
1971
|
+
*
|
|
1972
|
+
* @returns the number of maps cooled and total file-backed bytes advised.
|
|
1973
|
+
*/
|
|
1733
1974
|
declare const coolTransactionLogs: () => {
|
|
1734
1975
|
maps: number;
|
|
1735
1976
|
bytes: number;
|
|
1736
1977
|
};
|
|
1737
1978
|
/**
|
|
1738
|
-
* Creates a native file lock using the specified file path (`flock` on POSIX,
|
|
1739
|
-
* `LockFileEx` on Windows)
|
|
1740
|
-
*
|
|
1741
|
-
*
|
|
1742
|
-
*
|
|
1743
|
-
*
|
|
1744
|
-
*
|
|
1745
|
-
|
|
1746
|
-
|
|
1979
|
+
* Creates a native file lock using the specified file path (`flock` on POSIX,
|
|
1980
|
+
* `LockFileEx` on Windows), creating the file and any missing parent
|
|
1981
|
+
* directories. Exclusive by default; pass `shared` for a shared (reader) lock
|
|
1982
|
+
* that coexists with other shared holders but conflicts with an exclusive
|
|
1983
|
+
* holder in either direction. Returns an opaque non-zero token to pass to
|
|
1984
|
+
* `fileLockRelease`, or `0` if a conflicting holder — in any process,
|
|
1985
|
+
* container, or worker thread — currently has it. Throws on a hard error. The
|
|
1986
|
+
* OS handle is owned entirely in native code (no fd crosses into JS), and the
|
|
1987
|
+
* kernel releases the lock when the handle closes, including on process death.
|
|
1988
|
+
*/
|
|
1989
|
+
declare const tryFileLock: (file: string, shared?: boolean) => number;
|
|
1747
1990
|
/**
|
|
1748
|
-
* Releases a file lock acquired via `tryFileLock`. A no-op for
|
|
1749
|
-
* token `0` or an unknown token.
|
|
1750
|
-
*/
|
|
1991
|
+
* Releases a file lock acquired via `tryFileLock`. A no-op for
|
|
1992
|
+
* token `0` or an unknown token.
|
|
1993
|
+
*/
|
|
1751
1994
|
declare const fileLockRelease: (token: number) => void;
|
|
1752
1995
|
declare const stats: {
|
|
1753
1996
|
StatsLevel: {
|
|
@@ -1763,32 +2006,32 @@ declare const stats: {
|
|
|
1763
2006
|
//#endregion
|
|
1764
2007
|
//#region src/backup-stream.d.ts
|
|
1765
2008
|
/**
|
|
1766
|
-
* Options for streaming a backup via `db.backup(stream)`.
|
|
1767
|
-
*/
|
|
2009
|
+
* Options for streaming a backup via `db.backup(stream)`.
|
|
2010
|
+
*/
|
|
1768
2011
|
interface BackupStreamOptions {
|
|
1769
2012
|
/**
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
2013
|
+
* Flush the memtable before streaming. Defaults to `true` when the database
|
|
2014
|
+
* was opened with `disableWAL` (otherwise unflushed data would be missing
|
|
2015
|
+
* from the stream), and `false` otherwise — matching `db.backup(dir)`.
|
|
2016
|
+
*/
|
|
1774
2017
|
flushBeforeBackup?: boolean;
|
|
1775
2018
|
/**
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
2019
|
+
* Gzip-compress the archive before writing it to the stream, producing a
|
|
2020
|
+
* `.tar.gz` stream instead of a plain `.tar`. Defaults to `false`.
|
|
2021
|
+
*
|
|
2022
|
+
* Compression runs in the runtime's `CompressionStream`, downstream of the tar
|
|
2023
|
+
* encoder, so end-to-end backpressure is preserved. RocksDB SST files are
|
|
2024
|
+
* usually already block-compressed, so the additional savings vary with the
|
|
2025
|
+
* data and the configured compression.
|
|
2026
|
+
*/
|
|
1784
2027
|
gzip?: boolean;
|
|
1785
2028
|
/**
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
2029
|
+
* Also stream the transaction log store as `transaction_logs/<store>/…`
|
|
2030
|
+
* entries (each `*.txnlog` and `txn.state` file) after the database files.
|
|
2031
|
+
* Defaults to `false`. Extraction reconstructs them next to the database, and
|
|
2032
|
+
* their mtimes are preserved so the store's age-based rotation/retention stays
|
|
2033
|
+
* correct.
|
|
2034
|
+
*/
|
|
1792
2035
|
transactionLogs?: boolean;
|
|
1793
2036
|
}
|
|
1794
2037
|
//#endregion
|
|
@@ -1796,418 +2039,432 @@ interface BackupStreamOptions {
|
|
|
1796
2039
|
type TransactionCallback<T> = (txn: Transaction, attempt: number) => T | PromiseLike<T>;
|
|
1797
2040
|
interface RocksDatabaseOptions extends StoreOptions {
|
|
1798
2041
|
/**
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
2042
|
+
* The column family name.
|
|
2043
|
+
*
|
|
2044
|
+
* @default 'default'
|
|
2045
|
+
*/
|
|
1803
2046
|
name?: string;
|
|
1804
2047
|
}
|
|
1805
2048
|
interface TransactionOptions extends NativeTransactionOptions {
|
|
1806
2049
|
/**
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
2050
|
+
* The maximum number of times to retry the transaction.
|
|
2051
|
+
*
|
|
2052
|
+
* @default 3
|
|
2053
|
+
*/
|
|
1811
2054
|
maxRetries?: number;
|
|
1812
2055
|
/**
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
2056
|
+
* Whether to retry the transaction if it fails with `IsBusy`.
|
|
2057
|
+
*
|
|
2058
|
+
* @default `true` when the transaction is bound to a transaction log, otherwise `false`
|
|
2059
|
+
*/
|
|
1817
2060
|
retryOnBusy?: boolean;
|
|
1818
2061
|
}
|
|
1819
2062
|
type RocksDBStat = StatsValue;
|
|
1820
2063
|
type RocksDBStats = StatsDefault | StatsAll;
|
|
1821
2064
|
/**
|
|
1822
|
-
* The main class for interacting with a RocksDB database.
|
|
1823
|
-
*
|
|
1824
|
-
* Before using this class, you must open the database first.
|
|
1825
|
-
*
|
|
1826
|
-
* @example
|
|
1827
|
-
* ```typescript
|
|
1828
|
-
* const db = RocksDatabase.open('/path/to/database');
|
|
1829
|
-
* await db.put('key', 'value');
|
|
1830
|
-
* const value = await db.get('key');
|
|
1831
|
-
* db.close();
|
|
1832
|
-
* ```
|
|
1833
|
-
*/
|
|
2065
|
+
* The main class for interacting with a RocksDB database.
|
|
2066
|
+
*
|
|
2067
|
+
* Before using this class, you must open the database first.
|
|
2068
|
+
*
|
|
2069
|
+
* @example
|
|
2070
|
+
* ```typescript
|
|
2071
|
+
* const db = RocksDatabase.open('/path/to/database');
|
|
2072
|
+
* await db.put('key', 'value');
|
|
2073
|
+
* const value = await db.get('key');
|
|
2074
|
+
* db.close();
|
|
2075
|
+
* ```
|
|
2076
|
+
*/
|
|
1834
2077
|
declare class RocksDatabase extends DBI<DBITransactional> {
|
|
1835
2078
|
#private;
|
|
1836
2079
|
constructor(pathOrStore: string | Store, options?: RocksDatabaseOptions);
|
|
1837
2080
|
/**
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
2081
|
+
* Removes all data from the database asynchronously.
|
|
2082
|
+
*
|
|
2083
|
+
* @example
|
|
2084
|
+
* ```typescript
|
|
2085
|
+
* const db = RocksDatabase.open('/path/to/database');
|
|
2086
|
+
* await db.clear();
|
|
2087
|
+
* ```
|
|
2088
|
+
*/
|
|
1846
2089
|
clear(): Promise<void>;
|
|
1847
2090
|
/**
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
2091
|
+
* Removes all entries from the database synchronously.
|
|
2092
|
+
*
|
|
2093
|
+
* @example
|
|
2094
|
+
* ```typescript
|
|
2095
|
+
* const db = RocksDatabase.open('/path/to/database');
|
|
2096
|
+
* db.clearSync();
|
|
2097
|
+
* ```
|
|
2098
|
+
*/
|
|
1856
2099
|
clearSync(): void;
|
|
1857
2100
|
/**
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
2101
|
+
* Closes the database.
|
|
2102
|
+
*
|
|
2103
|
+
* @example
|
|
2104
|
+
* ```typescript
|
|
2105
|
+
* const db = RocksDatabase.open('/path/to/database');
|
|
2106
|
+
* db.close();
|
|
2107
|
+
* ```
|
|
2108
|
+
*/
|
|
1866
2109
|
close(): void;
|
|
1867
2110
|
/**
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
2111
|
+
* Compacts the entire key range of the database asynchronously.
|
|
2112
|
+
* This triggers manual compaction which removes tombstones and reclaims space.
|
|
2113
|
+
*
|
|
2114
|
+
* @example
|
|
2115
|
+
* ```typescript
|
|
2116
|
+
* const db = RocksDatabase.open('/path/to/database');
|
|
2117
|
+
* await db.compact();
|
|
2118
|
+
* ```
|
|
2119
|
+
*/
|
|
1877
2120
|
compact(options?: CompactOptions): Promise<void>;
|
|
1878
2121
|
/**
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
2122
|
+
* Creates a backup of the entire database (all column families) into the
|
|
2123
|
+
* given directory, creating parent directories as needed, and resolves with
|
|
2124
|
+
* the new backup id. Use the `backups` namespace to restore, list, delete,
|
|
2125
|
+
* purge, or verify backups.
|
|
2126
|
+
*
|
|
2127
|
+
* When the database was opened with `disableWAL`, the memtable is flushed
|
|
2128
|
+
* before the backup by default so unflushed data is not lost.
|
|
2129
|
+
*
|
|
2130
|
+
* @example
|
|
2131
|
+
* ```typescript
|
|
2132
|
+
* import { backups } from '@harperfast/rocksdb-js';
|
|
2133
|
+
*
|
|
2134
|
+
* const db = RocksDatabase.open('/path/to/database');
|
|
2135
|
+
* const id = await db.backup('/path/to/backups');
|
|
2136
|
+
* ```
|
|
2137
|
+
*/
|
|
1895
2138
|
backup(backupDir: string, options?: BackupOptions): Promise<number>;
|
|
1896
2139
|
/**
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
2140
|
+
* Streams a consistent snapshot of the entire database to a `WritableStream`
|
|
2141
|
+
* as a tar archive, with no intermediate copy written to disk. Resolves once
|
|
2142
|
+
* the stream has been fully written and closed.
|
|
2143
|
+
*
|
|
2144
|
+
* Backpressure is honored end to end, so a slow consumer (e.g. a network or
|
|
2145
|
+
* S3 upload) paces the backup rather than buffering it in memory. The archive
|
|
2146
|
+
* unpacks with any tar tool into a directory that opens as a RocksDB database.
|
|
2147
|
+
*
|
|
2148
|
+
* @example
|
|
2149
|
+
* ```typescript
|
|
2150
|
+
* const file = await fetch(uploadUrl, { method: 'PUT', body: stream });
|
|
2151
|
+
* await db.backup(stream); // `stream` is the request's WritableStream
|
|
2152
|
+
* ```
|
|
2153
|
+
*/
|
|
1911
2154
|
backup(stream: WritableStream<Uint8Array>, options?: BackupStreamOptions): Promise<void>;
|
|
1912
2155
|
/**
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
2156
|
+
* Creates a hardlinked, point-in-time, fully independent copy of the entire
|
|
2157
|
+
* database (all column families) at `targetPath` and resolves once written.
|
|
2158
|
+
*
|
|
2159
|
+
* Unlike a backup, a checkpoint is a normal, writable sibling database: open
|
|
2160
|
+
* it with {@link RocksDatabase.open} and it diverges independently from the
|
|
2161
|
+
* source. SST and blob files are hardlinked when `targetPath` is on the same
|
|
2162
|
+
* filesystem as the database and copied otherwise (other files such as the
|
|
2163
|
+
* MANIFEST are always copied), so the operation is near-instant on the same
|
|
2164
|
+
* filesystem. The memtable is flushed so the checkpoint includes the latest
|
|
2165
|
+
* writes even when the WAL is disabled.
|
|
2166
|
+
*
|
|
2167
|
+
* Parent directories are created as needed. `targetPath` itself must not
|
|
2168
|
+
* already exist (RocksDB creates the checkpoint directory) and rejects with
|
|
2169
|
+
* `Create checkpoint failed: target path exists` if it does. The caller is
|
|
2170
|
+
* responsible for eventual cleanup of the directory.
|
|
2171
|
+
*
|
|
2172
|
+
* @example
|
|
2173
|
+
* ```typescript
|
|
2174
|
+
* const db = RocksDatabase.open('/path/to/database');
|
|
2175
|
+
* await db.createCheckpoint('/path/to/checkpoint');
|
|
2176
|
+
* const branch = RocksDatabase.open('/path/to/checkpoint');
|
|
2177
|
+
* ```
|
|
2178
|
+
*/
|
|
1936
2179
|
createCheckpoint(targetPath: string): Promise<void>;
|
|
1937
2180
|
/**
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
2181
|
+
* Compacts the entire key range of the database synchronously.
|
|
2182
|
+
* This triggers manual compaction which removes tombstones and reclaims space.
|
|
2183
|
+
*
|
|
2184
|
+
* @example
|
|
2185
|
+
* ```typescript
|
|
2186
|
+
* const db = RocksDatabase.open('/path/to/database');
|
|
2187
|
+
* db.compactSync();
|
|
2188
|
+
* ```
|
|
2189
|
+
*/
|
|
1947
2190
|
compactSync(options?: CompactOptions): void;
|
|
1948
2191
|
/**
|
|
1949
|
-
|
|
1950
|
-
|
|
2192
|
+
* Returns the list of column families in the RocksDB database.
|
|
2193
|
+
*/
|
|
1951
2194
|
get columns(): string[];
|
|
1952
2195
|
/**
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
2196
|
+
* The compression currently in effect for this database's column family, read
|
|
2197
|
+
* live from RocksDB, as `{ algorithm, level? }`. `algorithm` is a friendly
|
|
2198
|
+
* name (e.g. `'lz4'`, `'zstd'`, `'none'`); `level` is present only when a
|
|
2199
|
+
* non-default compression level is set. The database must be open. Defaults to
|
|
2200
|
+
* LZ4 when the native build supports it.
|
|
2201
|
+
*
|
|
2202
|
+
* @example
|
|
2203
|
+
* ```typescript
|
|
2204
|
+
* const db = RocksDatabase.open('/path/to/db', { compression: { algorithm: 'zstd', level: 3 } });
|
|
2205
|
+
* db.compression; // { algorithm: 'zstd', level: 3 }
|
|
2206
|
+
* ```
|
|
2207
|
+
*/
|
|
2208
|
+
get compression(): CompressionInfo;
|
|
2209
|
+
/**
|
|
2210
|
+
* Set global database settings.
|
|
2211
|
+
*
|
|
2212
|
+
* @param options - The options for the database.
|
|
2213
|
+
*
|
|
2214
|
+
* @example
|
|
2215
|
+
* ```typescript
|
|
2216
|
+
* RocksDatabase.config({ blockCacheSize: 1024 * 1024 });
|
|
2217
|
+
* ```
|
|
2218
|
+
*/
|
|
1962
2219
|
static config(options: RocksDatabaseConfig): void;
|
|
1963
2220
|
/**
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
2221
|
+
* Registers a process-wide event listener. Internal events emitted by the
|
|
2222
|
+
* native binding use namespaced keys (e.g. `'transactionLog:warning'`).
|
|
2223
|
+
*
|
|
2224
|
+
* Listeners are not tied to any specific database — they fire for every
|
|
2225
|
+
* matching event emitted in this process.
|
|
2226
|
+
*
|
|
2227
|
+
* @example
|
|
2228
|
+
* ```typescript
|
|
2229
|
+
* RocksDatabase.on('transactionLog:warning', (warning) => {
|
|
2230
|
+
* console.warn(warning);
|
|
2231
|
+
* });
|
|
2232
|
+
* ```
|
|
2233
|
+
*/
|
|
1977
2234
|
static on(event: string, callback: (...args: any[]) => void): void;
|
|
1978
2235
|
/**
|
|
1979
|
-
|
|
1980
|
-
|
|
2236
|
+
* Alias for {@link RocksDatabase.on}, mirroring the Node `EventEmitter` API.
|
|
2237
|
+
*/
|
|
1981
2238
|
static addListener(event: string, callback: (...args: any[]) => void): void;
|
|
1982
2239
|
/**
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
2240
|
+
* Removes a previously-registered process-wide event listener. The
|
|
2241
|
+
* callback identity must match the one passed to {@link RocksDatabase.on}.
|
|
2242
|
+
*
|
|
2243
|
+
* @returns `true` if a matching listener was removed.
|
|
2244
|
+
*/
|
|
1988
2245
|
static off(event: string, callback: (...args: any[]) => void): boolean;
|
|
1989
2246
|
/**
|
|
1990
|
-
|
|
1991
|
-
|
|
2247
|
+
* Alias for {@link RocksDatabase.off}, mirroring the Node `EventEmitter` API.
|
|
2248
|
+
*/
|
|
1992
2249
|
static removeListener(event: string, callback: (...args: any[]) => void): boolean;
|
|
1993
2250
|
/**
|
|
1994
|
-
|
|
1995
|
-
|
|
2251
|
+
* Returns the number of process-wide listeners registered for the given event.
|
|
2252
|
+
*/
|
|
1996
2253
|
static listenerCount(event: string): number;
|
|
1997
2254
|
/**
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2255
|
+
* Emits a process-wide event. Mostly intended for tests and as a peer to
|
|
2256
|
+
* {@link RocksDatabase.on} — native code should call `emitGlobalEvent` in
|
|
2257
|
+
* `napi/global_events.h` directly rather than round-tripping through JS.
|
|
2258
|
+
*
|
|
2259
|
+
* @returns `true` if there was at least one listener.
|
|
2260
|
+
*/
|
|
2004
2261
|
static notify(event: string, ...args: any[]): boolean;
|
|
2005
2262
|
destroy(): void;
|
|
2006
2263
|
drop(): Promise<void>;
|
|
2007
2264
|
dropSync(): void;
|
|
2008
2265
|
get encoder(): Encoder | null;
|
|
2009
2266
|
/**
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2267
|
+
* Flushes the underlying database by performing a commit or clearing any buffered operations.
|
|
2268
|
+
*
|
|
2269
|
+
* @return {void} Does not return a value.
|
|
2270
|
+
*/
|
|
2014
2271
|
flush(): Promise<void>;
|
|
2015
2272
|
/**
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2273
|
+
* Synchronously flushes the underlying database by performing a commit or clearing any buffered operations.
|
|
2274
|
+
*
|
|
2275
|
+
* @return {void} Does not return a value.
|
|
2276
|
+
*/
|
|
2020
2277
|
flushSync(): void;
|
|
2021
2278
|
/**
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2279
|
+
* Gets a RocksDB database property as an integer.
|
|
2280
|
+
*
|
|
2281
|
+
* @param propertyName - The name of the property to retrieve (e.g., 'rocksdb.num-blob-files').
|
|
2282
|
+
* @returns The property value as a number.
|
|
2283
|
+
*
|
|
2284
|
+
* @example
|
|
2285
|
+
* ```typescript
|
|
2286
|
+
* const db = RocksDatabase.open('/path/to/database');
|
|
2287
|
+
* const blobFiles = db.getDBIntProperty('rocksdb.num-blob-files');
|
|
2288
|
+
* const numKeys = db.getDBIntProperty('rocksdb.estimate-num-keys');
|
|
2289
|
+
* ```
|
|
2290
|
+
*/
|
|
2034
2291
|
getDBIntProperty(propertyName: string): number | undefined;
|
|
2035
2292
|
/**
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2293
|
+
* Gets a RocksDB database property as a string.
|
|
2294
|
+
*
|
|
2295
|
+
* @param propertyName - The name of the property to retrieve (e.g., 'rocksdb.levelstats').
|
|
2296
|
+
* @returns The property value as a string.
|
|
2297
|
+
*
|
|
2298
|
+
* @example
|
|
2299
|
+
* ```typescript
|
|
2300
|
+
* const db = RocksDatabase.open('/path/to/database');
|
|
2301
|
+
* const levelStats = db.getDBProperty('rocksdb.levelstats');
|
|
2302
|
+
* const stats = db.getDBProperty('rocksdb.stats');
|
|
2303
|
+
* ```
|
|
2304
|
+
*/
|
|
2048
2305
|
getDBProperty(propertyName: string): string | undefined;
|
|
2049
2306
|
/**
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2307
|
+
* Retrieves the estimated number of keys in the database.
|
|
2308
|
+
*
|
|
2309
|
+
* @example
|
|
2310
|
+
* ```typescript
|
|
2311
|
+
* const db = RocksDatabase.open('/path/to/database');
|
|
2312
|
+
* const estimated = db.getEstimatedKeyCount();
|
|
2313
|
+
* console.log(estimated);
|
|
2314
|
+
* ```
|
|
2315
|
+
*/
|
|
2059
2316
|
getEstimatedKeyCount(): number;
|
|
2060
2317
|
/**
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2318
|
+
* Returns the current timestamp as a monotonically increasing timestamp in
|
|
2319
|
+
* milliseconds represented as a decimal number.
|
|
2320
|
+
*
|
|
2321
|
+
* @returns The current monotonic timestamp in milliseconds.
|
|
2322
|
+
*/
|
|
2066
2323
|
getMonotonicTimestamp(): number;
|
|
2067
2324
|
/**
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2325
|
+
* Returns a number representing a unix timestamp of the oldest unreleased
|
|
2326
|
+
* snapshot.
|
|
2327
|
+
*
|
|
2328
|
+
* @returns The oldest snapshot timestamp.
|
|
2329
|
+
*/
|
|
2073
2330
|
getOldestSnapshotTimestamp(): number;
|
|
2074
2331
|
/**
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2332
|
+
* Gets a RocksDB statistic.
|
|
2333
|
+
*
|
|
2334
|
+
* @param statName - The name of the statistic to retrieve.
|
|
2335
|
+
* @returns The statistic value.
|
|
2336
|
+
*/
|
|
2080
2337
|
getStat(statName: string): RocksDBStat;
|
|
2081
2338
|
/**
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2339
|
+
* Gets the RocksDB statistics. The RocksDB ticker/histogram stats require
|
|
2340
|
+
* statistics to be enabled, but the result always includes a summarized,
|
|
2341
|
+
* aggregate set of `txnlog.*` keys (across all of this database's transaction
|
|
2342
|
+
* logs), regardless of whether statistics are enabled. For detailed per-log
|
|
2343
|
+
* statistics, including memory-map usage, use `log.getStats()` on the log
|
|
2344
|
+
* returned by {@link RocksDatabase#useLog}.
|
|
2345
|
+
*
|
|
2346
|
+
* @example
|
|
2347
|
+
* ```typescript
|
|
2348
|
+
* const db = RocksDatabase.open('/path/to/database');
|
|
2349
|
+
* const stats = db.getStats();
|
|
2350
|
+
* stats['txnlog.totalSizeBytes']; // bytes across all transaction logs
|
|
2351
|
+
* ```
|
|
2352
|
+
*/
|
|
2096
2353
|
getStats(all?: false): StatsDefault;
|
|
2097
2354
|
getStats(all: true): StatsAll;
|
|
2098
2355
|
/**
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2356
|
+
* Gets or creates a buffer that can be shared across worker threads.
|
|
2357
|
+
*
|
|
2358
|
+
* @param key - The key to get or create the buffer for.
|
|
2359
|
+
* @param defaultBuffer - The default buffer to copy and use if the buffer
|
|
2360
|
+
* does not exist.
|
|
2361
|
+
* @param [options] - The options for the buffer.
|
|
2362
|
+
* @param [options.callback] - A optional callback that receives
|
|
2363
|
+
* key-specific events.
|
|
2364
|
+
* @returns An `ArrayBuffer` that is internally backed by a shared block of
|
|
2365
|
+
* memory. The buffer also has `notify()` and `cancel()` methods that can be
|
|
2366
|
+
* used to notify the specified `options.callback`.
|
|
2367
|
+
*
|
|
2368
|
+
* @example
|
|
2369
|
+
* ```typescript
|
|
2370
|
+
* const db = RocksDatabase.open('/path/to/database');
|
|
2371
|
+
* const buffer = db.getUserSharedBuffer('foo', new ArrayBuffer(10));
|
|
2372
|
+
*/
|
|
2116
2373
|
getUserSharedBuffer(key: Key, defaultBuffer: ArrayBuffer, options?: UserSharedBufferOptions): ArrayBufferWithNotify;
|
|
2117
2374
|
/**
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2375
|
+
* Returns whether the database has a lock for the given key.
|
|
2376
|
+
*
|
|
2377
|
+
* @param key - The key to check.
|
|
2378
|
+
* @returns `true` if the database has a lock for the given key, `false`
|
|
2379
|
+
* otherwise.
|
|
2380
|
+
*
|
|
2381
|
+
* @example
|
|
2382
|
+
* ```typescript
|
|
2383
|
+
* const db = RocksDatabase.open('/path/to/database');
|
|
2384
|
+
* db.hasLock('foo'); // false
|
|
2385
|
+
* db.tryLock('foo', () => {});
|
|
2386
|
+
* db.hasLock('foo'); // true
|
|
2387
|
+
* ```
|
|
2388
|
+
*/
|
|
2132
2389
|
hasLock(key: Key): boolean;
|
|
2133
2390
|
ifNoExists(_key: Key): Promise<void>;
|
|
2134
2391
|
/**
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2392
|
+
* Checks the process-global verification table for a fresh version match
|
|
2393
|
+
* on `key`. Returns `true` when the table currently records `version`. Use
|
|
2394
|
+
* this as a fast cache-freshness check before falling back to a full read:
|
|
2395
|
+
*
|
|
2396
|
+
* ```typescript
|
|
2397
|
+
* if (db.verifyVersion(key, cachedEntry.version)) {
|
|
2398
|
+
* return cachedEntry.value;
|
|
2399
|
+
* }
|
|
2400
|
+
* const value = db.getSync(key);
|
|
2401
|
+
* db.populateVersion(key, extractVersion(value));
|
|
2402
|
+
* ```
|
|
2403
|
+
*/
|
|
2147
2404
|
verifyVersion(key: Key, version: number): boolean;
|
|
2148
2405
|
/**
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2406
|
+
* Seeds the verification-table slot for `key` with `version`. Has no
|
|
2407
|
+
* effect if the slot is currently lock-tagged or if the verification
|
|
2408
|
+
* table is disabled.
|
|
2409
|
+
*/
|
|
2153
2410
|
populateVersion(key: Key, version: number): void;
|
|
2154
2411
|
/**
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2412
|
+
* Returns whether the database is open.
|
|
2413
|
+
*
|
|
2414
|
+
* @returns `true` if the database is open, `false` otherwise.
|
|
2415
|
+
*/
|
|
2159
2416
|
isOpen(): boolean;
|
|
2160
2417
|
/**
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2418
|
+
* Lists all transaction log names.
|
|
2419
|
+
*
|
|
2420
|
+
* @returns an array of transaction log names.
|
|
2421
|
+
*/
|
|
2165
2422
|
listLogs(): string[];
|
|
2166
2423
|
/**
|
|
2167
|
-
|
|
2168
|
-
|
|
2424
|
+
* The name of the database.
|
|
2425
|
+
*/
|
|
2169
2426
|
get name(): string;
|
|
2170
2427
|
/**
|
|
2171
|
-
|
|
2172
|
-
|
|
2428
|
+
* Whether the database is open in readonly mode.
|
|
2429
|
+
*/
|
|
2173
2430
|
get readOnly(): boolean;
|
|
2174
2431
|
/**
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2432
|
+
* Sugar method for opening a database.
|
|
2433
|
+
*
|
|
2434
|
+
* @param pathOrStore - The filesystem path to the database or a custom store.
|
|
2435
|
+
* @param options - The options for the database.
|
|
2436
|
+
* @returns A new RocksDatabase instance.
|
|
2437
|
+
*
|
|
2438
|
+
* @example
|
|
2439
|
+
* ```typescript
|
|
2440
|
+
* const db = RocksDatabase.open('/path/to/database');
|
|
2441
|
+
* ```
|
|
2442
|
+
*/
|
|
2186
2443
|
static open(pathOrStore: string | Store, options?: RocksDatabaseOptions): RocksDatabase;
|
|
2187
2444
|
/**
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2445
|
+
* Opens the database. This function returns immediately if the database is
|
|
2446
|
+
* already open.
|
|
2447
|
+
*
|
|
2448
|
+
* @returns A new RocksDatabase instance.
|
|
2449
|
+
*
|
|
2450
|
+
* @example
|
|
2451
|
+
* ```typescript
|
|
2452
|
+
* const db = new RocksDatabase('/path/to/database');
|
|
2453
|
+
* db.open();
|
|
2454
|
+
* ```
|
|
2455
|
+
*/
|
|
2199
2456
|
open(): RocksDatabase;
|
|
2200
2457
|
/**
|
|
2201
|
-
|
|
2202
|
-
|
|
2458
|
+
* Returns the path to the database.
|
|
2459
|
+
*/
|
|
2203
2460
|
get path(): string;
|
|
2204
2461
|
/**
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2462
|
+
* Purges transaction logs.
|
|
2463
|
+
*
|
|
2464
|
+
* By default returns the paths of the deleted log files. Pass
|
|
2465
|
+
* `includeEntryCounts: true` to instead return, for each deleted file, its
|
|
2466
|
+
* path and the number of entries it held (`{ path, entries }`).
|
|
2467
|
+
*/
|
|
2211
2468
|
purgeLogs(options: PurgeLogsOptions & {
|
|
2212
2469
|
includeEntryCounts: true;
|
|
2213
2470
|
}): PurgedLog[];
|
|
@@ -2216,93 +2473,93 @@ declare class RocksDatabase extends DBI<DBITransactional> {
|
|
|
2216
2473
|
}): string[];
|
|
2217
2474
|
purgeLogs(options?: PurgeLogsOptions): string[] | PurgedLog[];
|
|
2218
2475
|
/**
|
|
2219
|
-
|
|
2220
|
-
|
|
2476
|
+
* The status of the database.
|
|
2477
|
+
*/
|
|
2221
2478
|
get status(): "open" | "closed";
|
|
2222
2479
|
/**
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2480
|
+
* Executes all operations in the callback as a single transaction.
|
|
2481
|
+
*
|
|
2482
|
+
* @param callback - A async function that receives the transaction as an argument.
|
|
2483
|
+
* @returns A promise that resolves the `callback` return value.
|
|
2484
|
+
*
|
|
2485
|
+
* @example
|
|
2486
|
+
* ```typescript
|
|
2487
|
+
* const db = RocksDatabase.open('/path/to/database');
|
|
2488
|
+
* await db.transaction(async (txn) => {
|
|
2489
|
+
* await txn.put('key', 'value');
|
|
2490
|
+
* });
|
|
2491
|
+
* ```
|
|
2492
|
+
*/
|
|
2236
2493
|
transaction<T>(callback: TransactionCallback<T>, options?: TransactionOptions): Promise<T | void>;
|
|
2237
2494
|
/**
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2495
|
+
* Executes all operations in the callback as a single transaction.
|
|
2496
|
+
*
|
|
2497
|
+
* @param callback - A function that receives the transaction as an
|
|
2498
|
+
* argument. If the callback return promise-like value, it is awaited
|
|
2499
|
+
* before committing the transaction. Otherwise, the callback is treated as
|
|
2500
|
+
* synchronous.
|
|
2501
|
+
* @returns The `callback` return value.
|
|
2502
|
+
*
|
|
2503
|
+
* @example
|
|
2504
|
+
* ```typescript
|
|
2505
|
+
* const db = RocksDatabase.open('/path/to/database');
|
|
2506
|
+
* await db.transaction(async (txn) => {
|
|
2507
|
+
* await txn.put('key', 'value');
|
|
2508
|
+
* });
|
|
2509
|
+
* ```
|
|
2510
|
+
*/
|
|
2254
2511
|
transactionSync<T>(callback: TransactionCallback<T>, options?: TransactionOptions): T | PromiseLike<T> | void;
|
|
2255
2512
|
/**
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2513
|
+
* Attempts to acquire a lock for a given key. If the lock is available,
|
|
2514
|
+
* the function returns `true` and the optional callback is never called.
|
|
2515
|
+
* If the lock is not available, the function returns `false` and the
|
|
2516
|
+
* callback is queued until the lock is released.
|
|
2517
|
+
*
|
|
2518
|
+
* @param key - The key to lock.
|
|
2519
|
+
* @param onUnlocked - A callback to call when the lock is released.
|
|
2520
|
+
*
|
|
2521
|
+
* @example
|
|
2522
|
+
* ```typescript
|
|
2523
|
+
* const db = RocksDatabase.open('/path/to/database');
|
|
2524
|
+
* db.tryLock('foo', () => {
|
|
2525
|
+
* console.log('lock acquired');
|
|
2526
|
+
* });
|
|
2527
|
+
* ```
|
|
2528
|
+
* @returns `true` if the lock was acquired, `false` otherwise.
|
|
2529
|
+
*/
|
|
2273
2530
|
tryLock(key: Key, onUnlocked?: () => void): boolean;
|
|
2274
2531
|
/**
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2532
|
+
* Releases the lock on the given key and calls any queued `onUnlocked`
|
|
2533
|
+
* callback handlers.
|
|
2534
|
+
*
|
|
2535
|
+
* @param key - The key to unlock.
|
|
2536
|
+
* @returns `true` if the lock was released or `false` if the lock did not
|
|
2537
|
+
* exist.
|
|
2538
|
+
*
|
|
2539
|
+
* @example
|
|
2540
|
+
* ```typescript
|
|
2541
|
+
* const db = RocksDatabase.open('/path/to/database');
|
|
2542
|
+
* db.tryLock('foo', () => {});
|
|
2543
|
+
* db.unlock('foo'); // returns `true`
|
|
2544
|
+
* db.unlock('foo'); // already unlocked, returns `false`
|
|
2545
|
+
* ```
|
|
2546
|
+
*/
|
|
2290
2547
|
unlock(key: Key): void;
|
|
2291
2548
|
/**
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2549
|
+
* Excecutes a function using a thread-safe lock to ensure mutual
|
|
2550
|
+
* exclusion.
|
|
2551
|
+
*
|
|
2552
|
+
* @param callback - A callback to call when the lock is acquired.
|
|
2553
|
+
* @returns A promise that resolves when the lock is acquired.
|
|
2554
|
+
*
|
|
2555
|
+
* @example
|
|
2556
|
+
* ```typescript
|
|
2557
|
+
* const db = RocksDatabase.open('/path/to/database');
|
|
2558
|
+
* await db.withLock(async (waited) => {
|
|
2559
|
+
* console.log('lock acquired', waited);
|
|
2560
|
+
* });
|
|
2561
|
+
* ```
|
|
2562
|
+
*/
|
|
2306
2563
|
withLock(key: Key, callback: () => void | Promise<void>): Promise<void> | undefined;
|
|
2307
2564
|
}
|
|
2308
2565
|
//#endregion
|
|
@@ -2323,10 +2580,10 @@ interface TransactionLog$1 {
|
|
|
2323
2580
|
version: number;
|
|
2324
2581
|
}
|
|
2325
2582
|
/**
|
|
2326
|
-
* Loads an entire transaction log file into memory.
|
|
2327
|
-
* @param path - The path to the transaction log file.
|
|
2328
|
-
* @returns The transaction log.
|
|
2329
|
-
*/
|
|
2583
|
+
* Loads an entire transaction log file into memory.
|
|
2584
|
+
* @param path - The path to the transaction log file.
|
|
2585
|
+
* @returns The transaction log.
|
|
2586
|
+
*/
|
|
2330
2587
|
declare function parseTransactionLog(path: string, options?: {
|
|
2331
2588
|
skipData?: boolean;
|
|
2332
2589
|
}): TransactionLog$1;
|
|
@@ -2337,5 +2594,5 @@ declare const versions: {
|
|
|
2337
2594
|
"rocksdb-js": string;
|
|
2338
2595
|
};
|
|
2339
2596
|
//#endregion
|
|
2340
|
-
export { type BackupInfo, type BackupOptions, type BackupStreamOptions, DBI, DBIterator, type GetStatsMethod, type IteratorOptions, type Key, type RestoreMode, type RestoreOptions, type RocksDBStat, type RocksDBStats, RocksDatabase, type RocksDatabaseOptions, type StatsAll, type StatsAllExtras, type StatsBasics, type StatsCurated, type StatsCuratedExtras, type StatsDefault, type StatsHistogramData, type StatsValue, Store, type StoreContext, type StoreGetOptions, type StoreIteratorOptions, type StorePutOptions, type StoreRangeOptions, type StoreRemoveOptions, Transaction, type TransactionEntry, TransactionLog, type TransactionLogPosition, type TransactionLogStats, backups, constants, coolTransactionLogs, currentThreadId, fileLockRelease, parseTransactionLog, registryStatus, shutdown, stats, tryFileLock, versions };
|
|
2597
|
+
export { type BackupInfo, type BackupOptions, type BackupStreamOptions, type CompressionAlgorithm, type CompressionInfo, type CompressionOption, DBI, DBIterator, type GetStatsMethod, type IteratorOptions, type Key, type RestoreMode, type RestoreOptions, type RocksDBStat, type RocksDBStats, RocksDatabase, type RocksDatabaseOptions, type StatsAll, type StatsAllExtras, type StatsBasics, type StatsCurated, type StatsCuratedExtras, type StatsDefault, type StatsHistogramData, type StatsValue, Store, type StoreContext, type StoreGetOptions, type StoreIteratorOptions, type StorePutOptions, type StoreRangeOptions, type StoreRemoveOptions, Transaction, type TransactionEntry, TransactionLog, type TransactionLogFileValidation, type TransactionLogPosition, type TransactionLogStats, type TransactionLogStoreValidation, type ValidateTransactionLogStoreOptions, backups, constants, coolTransactionLogs, currentThreadId, fileLockRelease, parseTransactionLog, registryStatus, shutdown, stats, supportedCompression, tryFileLock, validateTransactionLogStore, versions };
|
|
2341
2598
|
//# sourceMappingURL=index.d.mts.map
|