@harperfast/rocksdb-js 2.6.1 → 2.7.1
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 +97 -4
- package/dist/index.cjs +75 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +140 -6
- package/dist/index.d.mts +140 -6
- package/dist/index.mjs +75 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +13 -13
package/dist/index.d.cts
CHANGED
|
@@ -255,6 +255,18 @@ type StoreRemoveOptions = DBITransactional | unknown;
|
|
|
255
255
|
type CompactOptions = {
|
|
256
256
|
start?: Key;
|
|
257
257
|
end?: Key;
|
|
258
|
+
/**
|
|
259
|
+
* Compact the bottommost level as well, rewriting every file in range.
|
|
260
|
+
*
|
|
261
|
+
* RocksDB skips the bottommost level by default when no compaction filter is installed, and
|
|
262
|
+
* that is where most of the data sits — so an ordinary `compact()` leaves it untouched. Since a
|
|
263
|
+
* changed `compression` algorithm only governs newly written files, rewriting that level is the
|
|
264
|
+
* only way to re-encode data that already exists.
|
|
265
|
+
*
|
|
266
|
+
* This rewrites the whole range regardless of whether RocksDB considers it worth doing, so it
|
|
267
|
+
* is as expensive as the data is large. Defaults to `false`.
|
|
268
|
+
*/
|
|
269
|
+
bottommost?: boolean;
|
|
258
270
|
};
|
|
259
271
|
/**
|
|
260
272
|
* A RocksDB block/blob compression algorithm. Which algorithms are actually
|
|
@@ -281,6 +293,23 @@ type CompressionInfo = {
|
|
|
281
293
|
algorithm: CompressionAlgorithm;
|
|
282
294
|
level?: number;
|
|
283
295
|
};
|
|
296
|
+
/**
|
|
297
|
+
* The informational-log settings currently in effect for a database, as
|
|
298
|
+
* returned by the `logOptions` getter. These are database-wide (`DBOptions`)
|
|
299
|
+
* settings, not per-column-family.
|
|
300
|
+
*/
|
|
301
|
+
type LogOptions = {
|
|
302
|
+
/**
|
|
303
|
+
* Per-file size cap (bytes) for informational log files (`LOG` /
|
|
304
|
+
* `LOG.old.*`).
|
|
305
|
+
*/
|
|
306
|
+
maxLogFileSize: number;
|
|
307
|
+
/**
|
|
308
|
+
* Verbosity of informational logging: `0` (debug), `1` (info), `2` (warn),
|
|
309
|
+
* `3` (error), `4` (fatal), or `5` (header-only).
|
|
310
|
+
*/
|
|
311
|
+
infoLogLevel: number;
|
|
312
|
+
};
|
|
284
313
|
/**
|
|
285
314
|
* Options for the `Store` class.
|
|
286
315
|
*/
|
|
@@ -302,6 +331,27 @@ interface StoreOptions extends Omit<NativeDatabaseOptions, "compression" | "comp
|
|
|
302
331
|
* @default 'lz4'
|
|
303
332
|
*/
|
|
304
333
|
compression?: CompressionOption;
|
|
334
|
+
/**
|
|
335
|
+
* Apply `compression` to every column family in the database, not only the one being opened.
|
|
336
|
+
*
|
|
337
|
+
* RocksDB opens all of a database's column families in a single native call, and by default
|
|
338
|
+
* each of the ones you did not name keeps its persisted algorithm. That is right when codecs
|
|
339
|
+
* are chosen per table, but it leaves a caller that wants one codec for the whole database
|
|
340
|
+
* unable to say so: those families are already open at their old algorithm before it gets a
|
|
341
|
+
* chance to ask, and a column family's compression cannot be changed while it is open.
|
|
342
|
+
*
|
|
343
|
+
* Setting this applies the requested algorithm to all of them instead — including families
|
|
344
|
+
* that were persisted with a different one, which is the point when adopting a codec on a
|
|
345
|
+
* database that predates it.
|
|
346
|
+
*
|
|
347
|
+
* Only meaningful with an explicit `compression` (it throws otherwise), and only on the open
|
|
348
|
+
* that actually creates the database handle; later opens of the same path reuse that handle
|
|
349
|
+
* and cannot revisit the decision. As always, the algorithm governs newly written files —
|
|
350
|
+
* existing SST/blob files keep theirs until rewritten (see `compact({ bottommost: true })`).
|
|
351
|
+
*
|
|
352
|
+
* @default false
|
|
353
|
+
*/
|
|
354
|
+
compressionForAllColumnFamilies?: boolean;
|
|
305
355
|
decoder?: Encoder | null;
|
|
306
356
|
encoder?: Encoder | null;
|
|
307
357
|
encoding?: Encoding;
|
|
@@ -375,6 +425,11 @@ declare class Store {
|
|
|
375
425
|
* store's column family. Normalized and applied when the database opens.
|
|
376
426
|
*/
|
|
377
427
|
compression?: CompressionOption;
|
|
428
|
+
/**
|
|
429
|
+
* Whether `compression` applies to every column family in the database rather than just this
|
|
430
|
+
* store's. See `RocksDatabaseOptions.compressionForAllColumnFamilies`.
|
|
431
|
+
*/
|
|
432
|
+
compressionForAllColumnFamilies: boolean;
|
|
378
433
|
/**
|
|
379
434
|
* Whether to disable the write ahead log.
|
|
380
435
|
*/
|
|
@@ -401,6 +456,11 @@ declare class Store {
|
|
|
401
456
|
* Encoder specific option used to signal that the data should be frozen.
|
|
402
457
|
*/
|
|
403
458
|
freezeData: boolean;
|
|
459
|
+
/**
|
|
460
|
+
* Verbosity of RocksDB's informational logging (`info_log_level`). Omit to
|
|
461
|
+
* leave RocksDB's own default.
|
|
462
|
+
*/
|
|
463
|
+
infoLogLevel?: number;
|
|
404
464
|
/**
|
|
405
465
|
* Reusable buffer for encoding keys.
|
|
406
466
|
*/
|
|
@@ -413,6 +473,16 @@ declare class Store {
|
|
|
413
473
|
* The maximum key size.
|
|
414
474
|
*/
|
|
415
475
|
maxKeySize: number;
|
|
476
|
+
/**
|
|
477
|
+
* Per-file size cap (bytes) for informational log files (`LOG` /
|
|
478
|
+
* `LOG.old.*`). Bounds total informational-log footprint to roughly `5 *
|
|
479
|
+
* maxLogFileSize` (RocksDB retains up to 5 of these files). A value of `0`
|
|
480
|
+
* is RocksDB's "single unbounded log file" mode: it disables size-based
|
|
481
|
+
* rotation, so the log can grow without limit — set it only if you want that.
|
|
482
|
+
*
|
|
483
|
+
* @default 16777216 (16MB)
|
|
484
|
+
*/
|
|
485
|
+
maxLogFileSize?: number;
|
|
416
486
|
/**
|
|
417
487
|
* The maximum number of table files RocksDB keeps open. `0` (the default)
|
|
418
488
|
* derives a budget from the effective per-process open-file limit (an
|
|
@@ -432,13 +502,26 @@ declare class Store {
|
|
|
432
502
|
/**
|
|
433
503
|
* The bytes of recent memtable history to retain in memory for transaction
|
|
434
504
|
* conflict checking. `-1` derives the value from
|
|
435
|
-
* `maxWriteBufferNumber * writeBufferSize
|
|
505
|
+
* `maxWriteBufferNumber * writeBufferSize`, except under a stalling
|
|
506
|
+
* `writeBufferManager`, where it derives `0`: retained history is charged to
|
|
507
|
+
* that manager and is only trimmable down to this target, so a target the
|
|
508
|
+
* budget cannot hold stalls writes permanently. Set a number to size it
|
|
509
|
+
* yourself against the budget and the column-family count.
|
|
436
510
|
*/
|
|
437
511
|
maxWriteBufferSizeToMaintain?: number;
|
|
438
512
|
/**
|
|
439
513
|
* The total memtable budget in bytes across all column families. When the
|
|
440
|
-
* sum of memtables reaches this size, RocksDB flushes the largest one.
|
|
441
|
-
* disables the global trigger so per-CF
|
|
514
|
+
* sum of memtables reaches this size, RocksDB flushes the largest one.
|
|
515
|
+
* Defaults to `0`, which disables the global trigger so per-CF
|
|
516
|
+
* `writeBufferSize` drives flushing.
|
|
517
|
+
*
|
|
518
|
+
* Set this only if you know your column-family count: it is one budget split
|
|
519
|
+
* across all of them, so a value that suits a few families starves many. To
|
|
520
|
+
* bound total memtable memory instead, configure a WriteBufferManager.
|
|
521
|
+
*
|
|
522
|
+
* Database-wide, so it binds when the path is first opened in this process:
|
|
523
|
+
* a later open of the same path — including from another worker thread —
|
|
524
|
+
* keeps the first opener's value rather than overriding or rejecting it.
|
|
442
525
|
*/
|
|
443
526
|
dbWriteBufferSize?: number;
|
|
444
527
|
/**
|
|
@@ -750,6 +833,15 @@ declare class Transaction extends DBI {
|
|
|
750
833
|
* @param options - The options for the transaction.
|
|
751
834
|
*/
|
|
752
835
|
constructor(store: Store, options?: NativeTransactionOptions);
|
|
836
|
+
/**
|
|
837
|
+
* Release the staged writes' verification-table write intents without
|
|
838
|
+
* closing the transaction, barring any later commit or write. For a
|
|
839
|
+
* transaction kept open only for its outstanding read iterators after the
|
|
840
|
+
* writes were replayed onto another transaction: otherwise other writers'
|
|
841
|
+
* coordinated-retry commits park on those intents until it is aborted.
|
|
842
|
+
* Reads keep working, including read-your-own-writes.
|
|
843
|
+
*/
|
|
844
|
+
abandonWrites(): void;
|
|
753
845
|
/**
|
|
754
846
|
* Abort the transaction.
|
|
755
847
|
*/
|
|
@@ -1605,6 +1697,7 @@ type NativeTransactionOptions = {
|
|
|
1605
1697
|
type NativeTransaction = {
|
|
1606
1698
|
id: number;
|
|
1607
1699
|
new (context: NativeDatabase, options?: NativeTransactionOptions): NativeTransaction;
|
|
1700
|
+
abandonWrites(): void;
|
|
1608
1701
|
abort(): void;
|
|
1609
1702
|
commit(resolve: (retrySignal?: number) => void, reject: (err: Error) => void): void;
|
|
1610
1703
|
commitSync(): void;
|
|
@@ -1755,9 +1848,30 @@ type NativeDatabaseOptions = {
|
|
|
1755
1848
|
* is algorithm-specific; omit to use the algorithm's default.
|
|
1756
1849
|
*/
|
|
1757
1850
|
compressionLevel?: number;
|
|
1851
|
+
/**
|
|
1852
|
+
* Apply `compression` to every column family the underlying `DB::Open` opens, rather than
|
|
1853
|
+
* only the one named by `name`. Requires an explicit `compression`.
|
|
1854
|
+
*/
|
|
1855
|
+
compressionForAllColumnFamilies?: boolean;
|
|
1758
1856
|
dbWriteBufferSize?: number;
|
|
1759
1857
|
disableWAL?: boolean;
|
|
1760
1858
|
enableStats?: boolean;
|
|
1859
|
+
/**
|
|
1860
|
+
* Verbosity of RocksDB's informational logging (`info_log_level`): `0`
|
|
1861
|
+
* (debug), `1` (info), `2` (warn), `3` (error), `4` (fatal), or `5`
|
|
1862
|
+
* (header-only). Omit to leave RocksDB's own default (`INFO_LEVEL` in a
|
|
1863
|
+
* release build of the linked RocksDB library).
|
|
1864
|
+
*/
|
|
1865
|
+
infoLogLevel?: number;
|
|
1866
|
+
/**
|
|
1867
|
+
* Per-file size cap (bytes) for informational log files (`LOG` /
|
|
1868
|
+
* `LOG.old.*`, `max_log_file_size`). RocksDB retains up to 5 of these files
|
|
1869
|
+
* (`keep_log_file_num`, not currently exposed as an option), so total
|
|
1870
|
+
* informational-log footprint is bounded at roughly `5 * maxLogFileSize`.
|
|
1871
|
+
*
|
|
1872
|
+
* @default 16777216 (16MB)
|
|
1873
|
+
*/
|
|
1874
|
+
maxLogFileSize?: number;
|
|
1761
1875
|
maxOpenFiles?: number;
|
|
1762
1876
|
maxWriteBufferNumber?: number;
|
|
1763
1877
|
maxWriteBufferSizeToMaintain?: number;
|
|
@@ -1812,8 +1926,8 @@ type NativeDatabase = {
|
|
|
1812
1926
|
clear(resolve: ResolveCallback<void>, reject: RejectCallback): void;
|
|
1813
1927
|
clearSync(): void;
|
|
1814
1928
|
close(): void;
|
|
1815
|
-
compact(resolve: ResolveCallback<void>, reject: RejectCallback, start?: Key, end?: Key): void;
|
|
1816
|
-
compactSync(start?: Key, end?: Key): void;
|
|
1929
|
+
compact(resolve: ResolveCallback<void>, reject: RejectCallback, start?: Key, end?: Key, bottommost?: boolean): void;
|
|
1930
|
+
compactSync(start?: Key, end?: Key, bottommost?: boolean): void;
|
|
1817
1931
|
columns: string[];
|
|
1818
1932
|
createCheckpoint(resolve: ResolveCallback<void>, reject: RejectCallback, targetPath: string): void;
|
|
1819
1933
|
destroy(): void;
|
|
@@ -1830,6 +1944,10 @@ type NativeDatabase = {
|
|
|
1830
1944
|
getCount(options?: RangeOptions, txnId?: number): number;
|
|
1831
1945
|
getDBIntProperty(propertyName: string): number | undefined;
|
|
1832
1946
|
getDBProperty(propertyName: string): string | undefined;
|
|
1947
|
+
getLogOptions(): {
|
|
1948
|
+
maxLogFileSize: number;
|
|
1949
|
+
infoLogLevel: number;
|
|
1950
|
+
};
|
|
1833
1951
|
getMonotonicTimestamp(): number;
|
|
1834
1952
|
getOldestSnapshotTimestamp(): number;
|
|
1835
1953
|
getStat(statName: string): number | StatsHistogramData;
|
|
@@ -2206,6 +2324,22 @@ declare class RocksDatabase extends DBI<DBITransactional> {
|
|
|
2206
2324
|
* ```
|
|
2207
2325
|
*/
|
|
2208
2326
|
get compression(): CompressionInfo;
|
|
2327
|
+
/**
|
|
2328
|
+
* The informational-log settings currently in effect for this database,
|
|
2329
|
+
* read live from RocksDB, as `{ maxLogFileSize, infoLogLevel }`. These are
|
|
2330
|
+
* database-wide settings (not per-column-family): `maxLogFileSize` bounds
|
|
2331
|
+
* each retained `LOG` / `LOG.old.*` file's size (defaults to 16MB, so with
|
|
2332
|
+
* RocksDB's `keep_log_file_num = 5` the total footprint is bounded at
|
|
2333
|
+
* roughly 80MB); `infoLogLevel` is the logging verbosity. The database must
|
|
2334
|
+
* be open.
|
|
2335
|
+
*
|
|
2336
|
+
* @example
|
|
2337
|
+
* ```typescript
|
|
2338
|
+
* const db = RocksDatabase.open('/path/to/db', { maxLogFileSize: 4 * 1024 * 1024 });
|
|
2339
|
+
* db.logOptions; // { maxLogFileSize: 4194304, infoLogLevel: 1 }
|
|
2340
|
+
* ```
|
|
2341
|
+
*/
|
|
2342
|
+
get logOptions(): LogOptions;
|
|
2209
2343
|
/**
|
|
2210
2344
|
* Set global database settings.
|
|
2211
2345
|
*
|
|
@@ -2594,5 +2728,5 @@ declare const versions: {
|
|
|
2594
2728
|
"rocksdb-js": string;
|
|
2595
2729
|
};
|
|
2596
2730
|
//#endregion
|
|
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 };
|
|
2731
|
+
export { type BackupInfo, type BackupOptions, type BackupStreamOptions, type CompressionAlgorithm, type CompressionInfo, type CompressionOption, DBI, DBIterator, type GetStatsMethod, type IteratorOptions, type Key, type LogOptions, 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 };
|
|
2598
2732
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.mts
CHANGED
|
@@ -255,6 +255,18 @@ type StoreRemoveOptions = DBITransactional | unknown;
|
|
|
255
255
|
type CompactOptions = {
|
|
256
256
|
start?: Key;
|
|
257
257
|
end?: Key;
|
|
258
|
+
/**
|
|
259
|
+
* Compact the bottommost level as well, rewriting every file in range.
|
|
260
|
+
*
|
|
261
|
+
* RocksDB skips the bottommost level by default when no compaction filter is installed, and
|
|
262
|
+
* that is where most of the data sits — so an ordinary `compact()` leaves it untouched. Since a
|
|
263
|
+
* changed `compression` algorithm only governs newly written files, rewriting that level is the
|
|
264
|
+
* only way to re-encode data that already exists.
|
|
265
|
+
*
|
|
266
|
+
* This rewrites the whole range regardless of whether RocksDB considers it worth doing, so it
|
|
267
|
+
* is as expensive as the data is large. Defaults to `false`.
|
|
268
|
+
*/
|
|
269
|
+
bottommost?: boolean;
|
|
258
270
|
};
|
|
259
271
|
/**
|
|
260
272
|
* A RocksDB block/blob compression algorithm. Which algorithms are actually
|
|
@@ -281,6 +293,23 @@ type CompressionInfo = {
|
|
|
281
293
|
algorithm: CompressionAlgorithm;
|
|
282
294
|
level?: number;
|
|
283
295
|
};
|
|
296
|
+
/**
|
|
297
|
+
* The informational-log settings currently in effect for a database, as
|
|
298
|
+
* returned by the `logOptions` getter. These are database-wide (`DBOptions`)
|
|
299
|
+
* settings, not per-column-family.
|
|
300
|
+
*/
|
|
301
|
+
type LogOptions = {
|
|
302
|
+
/**
|
|
303
|
+
* Per-file size cap (bytes) for informational log files (`LOG` /
|
|
304
|
+
* `LOG.old.*`).
|
|
305
|
+
*/
|
|
306
|
+
maxLogFileSize: number;
|
|
307
|
+
/**
|
|
308
|
+
* Verbosity of informational logging: `0` (debug), `1` (info), `2` (warn),
|
|
309
|
+
* `3` (error), `4` (fatal), or `5` (header-only).
|
|
310
|
+
*/
|
|
311
|
+
infoLogLevel: number;
|
|
312
|
+
};
|
|
284
313
|
/**
|
|
285
314
|
* Options for the `Store` class.
|
|
286
315
|
*/
|
|
@@ -302,6 +331,27 @@ interface StoreOptions extends Omit<NativeDatabaseOptions, "compression" | "comp
|
|
|
302
331
|
* @default 'lz4'
|
|
303
332
|
*/
|
|
304
333
|
compression?: CompressionOption;
|
|
334
|
+
/**
|
|
335
|
+
* Apply `compression` to every column family in the database, not only the one being opened.
|
|
336
|
+
*
|
|
337
|
+
* RocksDB opens all of a database's column families in a single native call, and by default
|
|
338
|
+
* each of the ones you did not name keeps its persisted algorithm. That is right when codecs
|
|
339
|
+
* are chosen per table, but it leaves a caller that wants one codec for the whole database
|
|
340
|
+
* unable to say so: those families are already open at their old algorithm before it gets a
|
|
341
|
+
* chance to ask, and a column family's compression cannot be changed while it is open.
|
|
342
|
+
*
|
|
343
|
+
* Setting this applies the requested algorithm to all of them instead — including families
|
|
344
|
+
* that were persisted with a different one, which is the point when adopting a codec on a
|
|
345
|
+
* database that predates it.
|
|
346
|
+
*
|
|
347
|
+
* Only meaningful with an explicit `compression` (it throws otherwise), and only on the open
|
|
348
|
+
* that actually creates the database handle; later opens of the same path reuse that handle
|
|
349
|
+
* and cannot revisit the decision. As always, the algorithm governs newly written files —
|
|
350
|
+
* existing SST/blob files keep theirs until rewritten (see `compact({ bottommost: true })`).
|
|
351
|
+
*
|
|
352
|
+
* @default false
|
|
353
|
+
*/
|
|
354
|
+
compressionForAllColumnFamilies?: boolean;
|
|
305
355
|
decoder?: Encoder | null;
|
|
306
356
|
encoder?: Encoder | null;
|
|
307
357
|
encoding?: Encoding;
|
|
@@ -375,6 +425,11 @@ declare class Store {
|
|
|
375
425
|
* store's column family. Normalized and applied when the database opens.
|
|
376
426
|
*/
|
|
377
427
|
compression?: CompressionOption;
|
|
428
|
+
/**
|
|
429
|
+
* Whether `compression` applies to every column family in the database rather than just this
|
|
430
|
+
* store's. See `RocksDatabaseOptions.compressionForAllColumnFamilies`.
|
|
431
|
+
*/
|
|
432
|
+
compressionForAllColumnFamilies: boolean;
|
|
378
433
|
/**
|
|
379
434
|
* Whether to disable the write ahead log.
|
|
380
435
|
*/
|
|
@@ -401,6 +456,11 @@ declare class Store {
|
|
|
401
456
|
* Encoder specific option used to signal that the data should be frozen.
|
|
402
457
|
*/
|
|
403
458
|
freezeData: boolean;
|
|
459
|
+
/**
|
|
460
|
+
* Verbosity of RocksDB's informational logging (`info_log_level`). Omit to
|
|
461
|
+
* leave RocksDB's own default.
|
|
462
|
+
*/
|
|
463
|
+
infoLogLevel?: number;
|
|
404
464
|
/**
|
|
405
465
|
* Reusable buffer for encoding keys.
|
|
406
466
|
*/
|
|
@@ -413,6 +473,16 @@ declare class Store {
|
|
|
413
473
|
* The maximum key size.
|
|
414
474
|
*/
|
|
415
475
|
maxKeySize: number;
|
|
476
|
+
/**
|
|
477
|
+
* Per-file size cap (bytes) for informational log files (`LOG` /
|
|
478
|
+
* `LOG.old.*`). Bounds total informational-log footprint to roughly `5 *
|
|
479
|
+
* maxLogFileSize` (RocksDB retains up to 5 of these files). A value of `0`
|
|
480
|
+
* is RocksDB's "single unbounded log file" mode: it disables size-based
|
|
481
|
+
* rotation, so the log can grow without limit — set it only if you want that.
|
|
482
|
+
*
|
|
483
|
+
* @default 16777216 (16MB)
|
|
484
|
+
*/
|
|
485
|
+
maxLogFileSize?: number;
|
|
416
486
|
/**
|
|
417
487
|
* The maximum number of table files RocksDB keeps open. `0` (the default)
|
|
418
488
|
* derives a budget from the effective per-process open-file limit (an
|
|
@@ -432,13 +502,26 @@ declare class Store {
|
|
|
432
502
|
/**
|
|
433
503
|
* The bytes of recent memtable history to retain in memory for transaction
|
|
434
504
|
* conflict checking. `-1` derives the value from
|
|
435
|
-
* `maxWriteBufferNumber * writeBufferSize
|
|
505
|
+
* `maxWriteBufferNumber * writeBufferSize`, except under a stalling
|
|
506
|
+
* `writeBufferManager`, where it derives `0`: retained history is charged to
|
|
507
|
+
* that manager and is only trimmable down to this target, so a target the
|
|
508
|
+
* budget cannot hold stalls writes permanently. Set a number to size it
|
|
509
|
+
* yourself against the budget and the column-family count.
|
|
436
510
|
*/
|
|
437
511
|
maxWriteBufferSizeToMaintain?: number;
|
|
438
512
|
/**
|
|
439
513
|
* The total memtable budget in bytes across all column families. When the
|
|
440
|
-
* sum of memtables reaches this size, RocksDB flushes the largest one.
|
|
441
|
-
* disables the global trigger so per-CF
|
|
514
|
+
* sum of memtables reaches this size, RocksDB flushes the largest one.
|
|
515
|
+
* Defaults to `0`, which disables the global trigger so per-CF
|
|
516
|
+
* `writeBufferSize` drives flushing.
|
|
517
|
+
*
|
|
518
|
+
* Set this only if you know your column-family count: it is one budget split
|
|
519
|
+
* across all of them, so a value that suits a few families starves many. To
|
|
520
|
+
* bound total memtable memory instead, configure a WriteBufferManager.
|
|
521
|
+
*
|
|
522
|
+
* Database-wide, so it binds when the path is first opened in this process:
|
|
523
|
+
* a later open of the same path — including from another worker thread —
|
|
524
|
+
* keeps the first opener's value rather than overriding or rejecting it.
|
|
442
525
|
*/
|
|
443
526
|
dbWriteBufferSize?: number;
|
|
444
527
|
/**
|
|
@@ -750,6 +833,15 @@ declare class Transaction extends DBI {
|
|
|
750
833
|
* @param options - The options for the transaction.
|
|
751
834
|
*/
|
|
752
835
|
constructor(store: Store, options?: NativeTransactionOptions);
|
|
836
|
+
/**
|
|
837
|
+
* Release the staged writes' verification-table write intents without
|
|
838
|
+
* closing the transaction, barring any later commit or write. For a
|
|
839
|
+
* transaction kept open only for its outstanding read iterators after the
|
|
840
|
+
* writes were replayed onto another transaction: otherwise other writers'
|
|
841
|
+
* coordinated-retry commits park on those intents until it is aborted.
|
|
842
|
+
* Reads keep working, including read-your-own-writes.
|
|
843
|
+
*/
|
|
844
|
+
abandonWrites(): void;
|
|
753
845
|
/**
|
|
754
846
|
* Abort the transaction.
|
|
755
847
|
*/
|
|
@@ -1605,6 +1697,7 @@ type NativeTransactionOptions = {
|
|
|
1605
1697
|
type NativeTransaction = {
|
|
1606
1698
|
id: number;
|
|
1607
1699
|
new (context: NativeDatabase, options?: NativeTransactionOptions): NativeTransaction;
|
|
1700
|
+
abandonWrites(): void;
|
|
1608
1701
|
abort(): void;
|
|
1609
1702
|
commit(resolve: (retrySignal?: number) => void, reject: (err: Error) => void): void;
|
|
1610
1703
|
commitSync(): void;
|
|
@@ -1755,9 +1848,30 @@ type NativeDatabaseOptions = {
|
|
|
1755
1848
|
* is algorithm-specific; omit to use the algorithm's default.
|
|
1756
1849
|
*/
|
|
1757
1850
|
compressionLevel?: number;
|
|
1851
|
+
/**
|
|
1852
|
+
* Apply `compression` to every column family the underlying `DB::Open` opens, rather than
|
|
1853
|
+
* only the one named by `name`. Requires an explicit `compression`.
|
|
1854
|
+
*/
|
|
1855
|
+
compressionForAllColumnFamilies?: boolean;
|
|
1758
1856
|
dbWriteBufferSize?: number;
|
|
1759
1857
|
disableWAL?: boolean;
|
|
1760
1858
|
enableStats?: boolean;
|
|
1859
|
+
/**
|
|
1860
|
+
* Verbosity of RocksDB's informational logging (`info_log_level`): `0`
|
|
1861
|
+
* (debug), `1` (info), `2` (warn), `3` (error), `4` (fatal), or `5`
|
|
1862
|
+
* (header-only). Omit to leave RocksDB's own default (`INFO_LEVEL` in a
|
|
1863
|
+
* release build of the linked RocksDB library).
|
|
1864
|
+
*/
|
|
1865
|
+
infoLogLevel?: number;
|
|
1866
|
+
/**
|
|
1867
|
+
* Per-file size cap (bytes) for informational log files (`LOG` /
|
|
1868
|
+
* `LOG.old.*`, `max_log_file_size`). RocksDB retains up to 5 of these files
|
|
1869
|
+
* (`keep_log_file_num`, not currently exposed as an option), so total
|
|
1870
|
+
* informational-log footprint is bounded at roughly `5 * maxLogFileSize`.
|
|
1871
|
+
*
|
|
1872
|
+
* @default 16777216 (16MB)
|
|
1873
|
+
*/
|
|
1874
|
+
maxLogFileSize?: number;
|
|
1761
1875
|
maxOpenFiles?: number;
|
|
1762
1876
|
maxWriteBufferNumber?: number;
|
|
1763
1877
|
maxWriteBufferSizeToMaintain?: number;
|
|
@@ -1812,8 +1926,8 @@ type NativeDatabase = {
|
|
|
1812
1926
|
clear(resolve: ResolveCallback<void>, reject: RejectCallback): void;
|
|
1813
1927
|
clearSync(): void;
|
|
1814
1928
|
close(): void;
|
|
1815
|
-
compact(resolve: ResolveCallback<void>, reject: RejectCallback, start?: Key, end?: Key): void;
|
|
1816
|
-
compactSync(start?: Key, end?: Key): void;
|
|
1929
|
+
compact(resolve: ResolveCallback<void>, reject: RejectCallback, start?: Key, end?: Key, bottommost?: boolean): void;
|
|
1930
|
+
compactSync(start?: Key, end?: Key, bottommost?: boolean): void;
|
|
1817
1931
|
columns: string[];
|
|
1818
1932
|
createCheckpoint(resolve: ResolveCallback<void>, reject: RejectCallback, targetPath: string): void;
|
|
1819
1933
|
destroy(): void;
|
|
@@ -1830,6 +1944,10 @@ type NativeDatabase = {
|
|
|
1830
1944
|
getCount(options?: RangeOptions, txnId?: number): number;
|
|
1831
1945
|
getDBIntProperty(propertyName: string): number | undefined;
|
|
1832
1946
|
getDBProperty(propertyName: string): string | undefined;
|
|
1947
|
+
getLogOptions(): {
|
|
1948
|
+
maxLogFileSize: number;
|
|
1949
|
+
infoLogLevel: number;
|
|
1950
|
+
};
|
|
1833
1951
|
getMonotonicTimestamp(): number;
|
|
1834
1952
|
getOldestSnapshotTimestamp(): number;
|
|
1835
1953
|
getStat(statName: string): number | StatsHistogramData;
|
|
@@ -2206,6 +2324,22 @@ declare class RocksDatabase extends DBI<DBITransactional> {
|
|
|
2206
2324
|
* ```
|
|
2207
2325
|
*/
|
|
2208
2326
|
get compression(): CompressionInfo;
|
|
2327
|
+
/**
|
|
2328
|
+
* The informational-log settings currently in effect for this database,
|
|
2329
|
+
* read live from RocksDB, as `{ maxLogFileSize, infoLogLevel }`. These are
|
|
2330
|
+
* database-wide settings (not per-column-family): `maxLogFileSize` bounds
|
|
2331
|
+
* each retained `LOG` / `LOG.old.*` file's size (defaults to 16MB, so with
|
|
2332
|
+
* RocksDB's `keep_log_file_num = 5` the total footprint is bounded at
|
|
2333
|
+
* roughly 80MB); `infoLogLevel` is the logging verbosity. The database must
|
|
2334
|
+
* be open.
|
|
2335
|
+
*
|
|
2336
|
+
* @example
|
|
2337
|
+
* ```typescript
|
|
2338
|
+
* const db = RocksDatabase.open('/path/to/db', { maxLogFileSize: 4 * 1024 * 1024 });
|
|
2339
|
+
* db.logOptions; // { maxLogFileSize: 4194304, infoLogLevel: 1 }
|
|
2340
|
+
* ```
|
|
2341
|
+
*/
|
|
2342
|
+
get logOptions(): LogOptions;
|
|
2209
2343
|
/**
|
|
2210
2344
|
* Set global database settings.
|
|
2211
2345
|
*
|
|
@@ -2594,5 +2728,5 @@ declare const versions: {
|
|
|
2594
2728
|
"rocksdb-js": string;
|
|
2595
2729
|
};
|
|
2596
2730
|
//#endregion
|
|
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 };
|
|
2731
|
+
export { type BackupInfo, type BackupOptions, type BackupStreamOptions, type CompressionAlgorithm, type CompressionInfo, type CompressionOption, DBI, DBIterator, type GetStatsMethod, type IteratorOptions, type Key, type LogOptions, 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 };
|
|
2598
2732
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.mjs
CHANGED
|
@@ -1280,6 +1280,11 @@ var Store = class {
|
|
|
1280
1280
|
*/
|
|
1281
1281
|
compression;
|
|
1282
1282
|
/**
|
|
1283
|
+
* Whether `compression` applies to every column family in the database rather than just this
|
|
1284
|
+
* store's. See `RocksDatabaseOptions.compressionForAllColumnFamilies`.
|
|
1285
|
+
*/
|
|
1286
|
+
compressionForAllColumnFamilies = false;
|
|
1287
|
+
/**
|
|
1283
1288
|
* Whether to disable the write ahead log.
|
|
1284
1289
|
*/
|
|
1285
1290
|
disableWAL;
|
|
@@ -1306,6 +1311,11 @@ var Store = class {
|
|
|
1306
1311
|
*/
|
|
1307
1312
|
freezeData;
|
|
1308
1313
|
/**
|
|
1314
|
+
* Verbosity of RocksDB's informational logging (`info_log_level`). Omit to
|
|
1315
|
+
* leave RocksDB's own default.
|
|
1316
|
+
*/
|
|
1317
|
+
infoLogLevel;
|
|
1318
|
+
/**
|
|
1309
1319
|
* Reusable buffer for encoding keys.
|
|
1310
1320
|
*/
|
|
1311
1321
|
keyBuffer;
|
|
@@ -1318,6 +1328,16 @@ var Store = class {
|
|
|
1318
1328
|
*/
|
|
1319
1329
|
maxKeySize;
|
|
1320
1330
|
/**
|
|
1331
|
+
* Per-file size cap (bytes) for informational log files (`LOG` /
|
|
1332
|
+
* `LOG.old.*`). Bounds total informational-log footprint to roughly `5 *
|
|
1333
|
+
* maxLogFileSize` (RocksDB retains up to 5 of these files). A value of `0`
|
|
1334
|
+
* is RocksDB's "single unbounded log file" mode: it disables size-based
|
|
1335
|
+
* rotation, so the log can grow without limit — set it only if you want that.
|
|
1336
|
+
*
|
|
1337
|
+
* @default 16777216 (16MB)
|
|
1338
|
+
*/
|
|
1339
|
+
maxLogFileSize;
|
|
1340
|
+
/**
|
|
1321
1341
|
* The maximum number of table files RocksDB keeps open. `0` (the default)
|
|
1322
1342
|
* derives a budget from the effective per-process open-file limit (an
|
|
1323
1343
|
* eighth of the limit — several databases can share one process — clamped
|
|
@@ -1336,13 +1356,26 @@ var Store = class {
|
|
|
1336
1356
|
/**
|
|
1337
1357
|
* The bytes of recent memtable history to retain in memory for transaction
|
|
1338
1358
|
* conflict checking. `-1` derives the value from
|
|
1339
|
-
* `maxWriteBufferNumber * writeBufferSize
|
|
1359
|
+
* `maxWriteBufferNumber * writeBufferSize`, except under a stalling
|
|
1360
|
+
* `writeBufferManager`, where it derives `0`: retained history is charged to
|
|
1361
|
+
* that manager and is only trimmable down to this target, so a target the
|
|
1362
|
+
* budget cannot hold stalls writes permanently. Set a number to size it
|
|
1363
|
+
* yourself against the budget and the column-family count.
|
|
1340
1364
|
*/
|
|
1341
1365
|
maxWriteBufferSizeToMaintain;
|
|
1342
1366
|
/**
|
|
1343
1367
|
* The total memtable budget in bytes across all column families. When the
|
|
1344
|
-
* sum of memtables reaches this size, RocksDB flushes the largest one.
|
|
1345
|
-
* disables the global trigger so per-CF
|
|
1368
|
+
* sum of memtables reaches this size, RocksDB flushes the largest one.
|
|
1369
|
+
* Defaults to `0`, which disables the global trigger so per-CF
|
|
1370
|
+
* `writeBufferSize` drives flushing.
|
|
1371
|
+
*
|
|
1372
|
+
* Set this only if you know your column-family count: it is one budget split
|
|
1373
|
+
* across all of them, so a value that suits a few families starves many. To
|
|
1374
|
+
* bound total memtable memory instead, configure a WriteBufferManager.
|
|
1375
|
+
*
|
|
1376
|
+
* Database-wide, so it binds when the path is first opened in this process:
|
|
1377
|
+
* a later open of the same path — including from another worker thread —
|
|
1378
|
+
* keeps the first opener's value rather than overriding or rejecting it.
|
|
1346
1379
|
*/
|
|
1347
1380
|
dbWriteBufferSize;
|
|
1348
1381
|
/**
|
|
@@ -1438,6 +1471,7 @@ var Store = class {
|
|
|
1438
1471
|
const { keyEncoding, readKey, writeKey } = initKeyEncoder(options?.keyEncoding, options?.keyEncoder);
|
|
1439
1472
|
this.db = new NativeDatabase();
|
|
1440
1473
|
this.compression = options?.compression;
|
|
1474
|
+
this.compressionForAllColumnFamilies = options?.compressionForAllColumnFamilies === true;
|
|
1441
1475
|
this.dbWriteBufferSize = options?.dbWriteBufferSize;
|
|
1442
1476
|
this.decoder = options?.decoder ?? null;
|
|
1443
1477
|
this.disableWAL = options?.disableWAL ?? false;
|
|
@@ -1446,9 +1480,11 @@ var Store = class {
|
|
|
1446
1480
|
this.encoder = options?.encoder ?? null;
|
|
1447
1481
|
this.encoding = options?.encoding ?? null;
|
|
1448
1482
|
this.freezeData = options?.freezeData ?? false;
|
|
1483
|
+
this.infoLogLevel = options?.infoLogLevel;
|
|
1449
1484
|
this.keyBuffer = KEY_BUFFER;
|
|
1450
1485
|
this.keyEncoding = keyEncoding;
|
|
1451
1486
|
this.maxKeySize = options?.maxKeySize ?? MAX_KEY_SIZE;
|
|
1487
|
+
this.maxLogFileSize = options?.maxLogFileSize;
|
|
1452
1488
|
this.maxOpenFiles = options?.maxOpenFiles;
|
|
1453
1489
|
this.maxWriteBufferNumber = options?.maxWriteBufferNumber;
|
|
1454
1490
|
this.maxWriteBufferSizeToMaintain = options?.maxWriteBufferSizeToMaintain;
|
|
@@ -1507,7 +1543,7 @@ var Store = class {
|
|
|
1507
1543
|
const end = this.encodeKey(options.end);
|
|
1508
1544
|
endBuffer = Buffer.from(end.subarray(end.start, end.end));
|
|
1509
1545
|
}
|
|
1510
|
-
return new Promise((resolve, reject) => this.db.compact(resolve, reject, startBuffer, endBuffer));
|
|
1546
|
+
return new Promise((resolve, reject) => this.db.compact(resolve, reject, startBuffer, endBuffer, options?.bottommost === true));
|
|
1511
1547
|
}
|
|
1512
1548
|
async backup(target, options) {
|
|
1513
1549
|
if (typeof target !== "string" && typeof target?.getWriter === "function") return backupToStream(this.db, target, options);
|
|
@@ -1535,7 +1571,7 @@ var Store = class {
|
|
|
1535
1571
|
const end = this.encodeKey(options.end);
|
|
1536
1572
|
endBuffer = Buffer.from(end.subarray(end.start, end.end));
|
|
1537
1573
|
}
|
|
1538
|
-
this.db.compactSync(startBuffer, endBuffer);
|
|
1574
|
+
this.db.compactSync(startBuffer, endBuffer, options?.bottommost === true);
|
|
1539
1575
|
}
|
|
1540
1576
|
/**
|
|
1541
1577
|
* Decodes a key from the database.
|
|
@@ -1752,9 +1788,12 @@ var Store = class {
|
|
|
1752
1788
|
this.db.open(this.path, {
|
|
1753
1789
|
compression,
|
|
1754
1790
|
compressionLevel,
|
|
1791
|
+
compressionForAllColumnFamilies: this.compressionForAllColumnFamilies,
|
|
1755
1792
|
dbWriteBufferSize: this.dbWriteBufferSize,
|
|
1756
1793
|
disableWAL: this.disableWAL,
|
|
1757
1794
|
enableStats: this.enableStats,
|
|
1795
|
+
infoLogLevel: this.infoLogLevel,
|
|
1796
|
+
maxLogFileSize: this.maxLogFileSize,
|
|
1758
1797
|
maxOpenFiles: this.maxOpenFiles,
|
|
1759
1798
|
maxWriteBufferNumber: this.maxWriteBufferNumber,
|
|
1760
1799
|
maxWriteBufferSizeToMaintain: this.maxWriteBufferSizeToMaintain,
|
|
@@ -1934,7 +1973,7 @@ var Transaction = class extends DBI {
|
|
|
1934
1973
|
if (store.readOnly) {
|
|
1935
1974
|
super(store);
|
|
1936
1975
|
this.#txn = { id: 0 };
|
|
1937
|
-
this.abort = this.commitSync = this.setTimestamp = () => {};
|
|
1976
|
+
this.abandonWrites = this.abort = this.commitSync = this.setTimestamp = () => {};
|
|
1938
1977
|
this.commit = async () => {};
|
|
1939
1978
|
this.getTimestamp = () => 0;
|
|
1940
1979
|
} else {
|
|
@@ -1944,6 +1983,17 @@ var Transaction = class extends DBI {
|
|
|
1944
1983
|
}
|
|
1945
1984
|
}
|
|
1946
1985
|
/**
|
|
1986
|
+
* Release the staged writes' verification-table write intents without
|
|
1987
|
+
* closing the transaction, barring any later commit or write. For a
|
|
1988
|
+
* transaction kept open only for its outstanding read iterators after the
|
|
1989
|
+
* writes were replayed onto another transaction: otherwise other writers'
|
|
1990
|
+
* coordinated-retry commits park on those intents until it is aborted.
|
|
1991
|
+
* Reads keep working, including read-your-own-writes.
|
|
1992
|
+
*/
|
|
1993
|
+
abandonWrites() {
|
|
1994
|
+
this.#txn.abandonWrites();
|
|
1995
|
+
}
|
|
1996
|
+
/**
|
|
1947
1997
|
* Abort the transaction.
|
|
1948
1998
|
*/
|
|
1949
1999
|
abort() {
|
|
@@ -2188,6 +2238,24 @@ var RocksDatabase = class RocksDatabase extends DBI {
|
|
|
2188
2238
|
return this.store.db.getCompression();
|
|
2189
2239
|
}
|
|
2190
2240
|
/**
|
|
2241
|
+
* The informational-log settings currently in effect for this database,
|
|
2242
|
+
* read live from RocksDB, as `{ maxLogFileSize, infoLogLevel }`. These are
|
|
2243
|
+
* database-wide settings (not per-column-family): `maxLogFileSize` bounds
|
|
2244
|
+
* each retained `LOG` / `LOG.old.*` file's size (defaults to 16MB, so with
|
|
2245
|
+
* RocksDB's `keep_log_file_num = 5` the total footprint is bounded at
|
|
2246
|
+
* roughly 80MB); `infoLogLevel` is the logging verbosity. The database must
|
|
2247
|
+
* be open.
|
|
2248
|
+
*
|
|
2249
|
+
* @example
|
|
2250
|
+
* ```typescript
|
|
2251
|
+
* const db = RocksDatabase.open('/path/to/db', { maxLogFileSize: 4 * 1024 * 1024 });
|
|
2252
|
+
* db.logOptions; // { maxLogFileSize: 4194304, infoLogLevel: 1 }
|
|
2253
|
+
* ```
|
|
2254
|
+
*/
|
|
2255
|
+
get logOptions() {
|
|
2256
|
+
return this.store.db.getLogOptions();
|
|
2257
|
+
}
|
|
2258
|
+
/**
|
|
2191
2259
|
* Set global database settings.
|
|
2192
2260
|
*
|
|
2193
2261
|
* @param options - The options for the database.
|
|
@@ -3017,7 +3085,7 @@ function loadLastPosition(transactionLog, readUncommitted) {
|
|
|
3017
3085
|
//#region src/index.ts
|
|
3018
3086
|
const versions = {
|
|
3019
3087
|
rocksdb: version,
|
|
3020
|
-
"rocksdb-js": "2.
|
|
3088
|
+
"rocksdb-js": "2.7.1"
|
|
3021
3089
|
};
|
|
3022
3090
|
|
|
3023
3091
|
//#endregion
|