@harperfast/rocksdb-js 2.13.0 → 2.14.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/dist/index.d.cts CHANGED
@@ -682,6 +682,10 @@ export declare class Store {
682
682
  * The memtable arena block size in bytes; `0` or unset is automatic.
683
683
  */
684
684
  arenaBlockSize?: number;
685
+ /**
686
+ * Bits per key of the whole-key filter in each SST; `0` disables filters.
687
+ */
688
+ bloomFilterBitsPerKey?: number;
685
689
  /**
686
690
  * The function used to encode keys using the shared `keyBuffer`.
687
691
  */
@@ -901,6 +905,9 @@ interface GetOptions {
901
905
  * When `true`, after a DB read the native layer automatically seeds the
902
906
  * verification-table slot with the version extracted from the value.
903
907
  * Eliminates the need for a separate `populateVersion` call on cold reads.
908
+ * Seeds nothing unless this handle participates in the verification
909
+ * table: opened with `verificationTable: true`, or opened without the
910
+ * option on a column family another handle opened with it.
904
911
  *
905
912
  * @default false
906
913
  */
@@ -1990,7 +1997,7 @@ type NativeTransaction = {
1990
1997
  abort(): void;
1991
1998
  commit(resolve: (retrySignal?: number) => void, reject: (err: Error) => void): void;
1992
1999
  commitSync(): void;
1993
- get(keyLengthOrKeyBuffer: number | Buffer, resolve: (value: Buffer | number) => void, reject: (err: Error) => void, txnIdIgnored?: number, expectedVersion?: number): number;
2000
+ get(keyLengthOrKeyBuffer: number | Buffer, resolve: (value: Buffer | number) => void, reject: (err: Error) => void, txnIdIgnored?: number, expectedVersion?: number, flags?: number): number;
1994
2001
  getCount(options?: RangeOptions): number;
1995
2002
  getSync(keyLengthOrKeyBuffer: number | Buffer): Buffer | number | undefined;
1996
2003
  getTimestamp(): number;
@@ -2016,7 +2023,20 @@ type TransactionLogQueryOptions = {
2016
2023
  startFromLastFlushed?: boolean;
2017
2024
  readUncommitted?: boolean;
2018
2025
  exclusiveStart?: boolean;
2026
+ /**
2027
+ * Stop before this same-log iterator's unread position, including a peeked entry.
2028
+ * Resumes when it advances; a closed iterator no longer bounds this query.
2029
+ * A pull short of the bound throws TransactionLogUntilUnreachedError.
2030
+ * Invalid or foreign-log iterators throw TypeError at query creation.
2031
+ */
2032
+ until?: TransactionLogIterator;
2019
2033
  };
2034
+ interface TransactionLogIterator extends IterableIterator<TransactionEntry> {
2035
+ /** Inspect the next entry without consuming it. A done result is never cached. */
2036
+ peek(): IteratorResult<TransactionEntry>;
2037
+ /** Permanently end this iterator and release any iterators bounded by it. */
2038
+ close(): void;
2039
+ }
2020
2040
  type TransactionEntry = {
2021
2041
  timestamp: number;
2022
2042
  data: Buffer;
@@ -2093,14 +2113,33 @@ type TransactionLogStats = {
2093
2113
  maxAgeThreshold: number;
2094
2114
  };
2095
2115
  };
2116
+ /**
2117
+ * Returned by {@link TransactionLog.getPurgeWatermark}. When `known`, `purgedThrough` is at or above
2118
+ * every entry key in every file deleted from the log (0 when none was). `known` is false when that
2119
+ * cannot be vouched for, such as a log created by a release without the watermark.
2120
+ */
2121
+ type TransactionLogPurgeWatermark = {
2122
+ known: true;
2123
+ purgedThrough: number;
2124
+ } | {
2125
+ known: false;
2126
+ };
2096
2127
  export type TransactionLog = {
2097
2128
  new (db: NativeDatabase, name: string): TransactionLog;
2098
2129
  addEntry(data: Buffer | Uint8Array, txnId?: number): void;
2130
+ /**
2131
+ * Whether `other` is the same logical log: the same database identity and log name.
2132
+ * Works after either database closes. A log destroyed and recreated under the same name
2133
+ * still compares equal.
2134
+ * Throws a TypeError when called on a receiver that is not a TransactionLog.
2135
+ */
2136
+ equals(other: unknown): boolean;
2099
2137
  getLogFileSize(sequenceId?: number): number;
2138
+ getPurgeWatermark(): TransactionLogPurgeWatermark;
2100
2139
  getStats(): TransactionLogStats;
2101
2140
  name: string;
2102
2141
  path: string;
2103
- query(options?: TransactionLogQueryOptions): IterableIterator<TransactionEntry>;
2142
+ query(options?: TransactionLogQueryOptions): TransactionLogIterator;
2104
2143
  _currentLogBuffer: WeakRef<LogBuffer> | undefined;
2105
2144
  _findPosition(timestamp: number): number;
2106
2145
  _findExactStart(timestamp: number, span: Float64Array): number;
@@ -2155,6 +2194,12 @@ type NativeDatabaseOptions = {
2155
2194
  * `min(1 MiB, writeBufferSize / 8)`.
2156
2195
  */
2157
2196
  arenaBlockSize?: number;
2197
+ /**
2198
+ * Bits per key of the whole-key filter written into each SST file (default
2199
+ * `10`, about a 1% false-positive rate); `0` writes no filter. Otherwise
2200
+ * 1 to 100, fractions allowed.
2201
+ */
2202
+ bloomFilterBitsPerKey?: number;
2158
2203
  /**
2159
2204
  * The friendly name of a compression algorithm compiled into this RocksDB
2160
2205
  * build (see `supportedCompression`), e.g. `'lz4'`, `'zstd'`, `'none'`. The
@@ -2239,7 +2284,10 @@ type NativeDatabaseOptions = {
2239
2284
  * When true, transaction writes to this column family invalidate the
2240
2285
  * VerificationTable slot for each written key at write time (not at
2241
2286
  * commit time). Enable only for column families whose records are
2242
- * cached (e.g. the primary CF of a table). Default: false.
2287
+ * cached (e.g. the primary CF of a table). Default: false. Left unset, a
2288
+ * handle joins a column family another handle opened with `true`; an
2289
+ * explicit `false` throws `ERR_VERIFICATION_TABLE_CONFLICT` while any
2290
+ * handle on that column family participates.
2243
2291
  */
2244
2292
  verificationTable?: boolean;
2245
2293
  writeBufferSize?: number;
@@ -2330,7 +2378,15 @@ type NativeDatabase = {
2330
2378
  flushSync(options?: FlushOptions): void;
2331
2379
  syncWal(resolve: ResolveCallback<void>, reject: RejectCallback): void;
2332
2380
  notify(event: string | BufferWithDataView, args?: any[]): boolean;
2333
- get(keyLengthOrKeyBuffer: number | Buffer, resolve: ResolveCallback<Buffer | number>, reject: RejectCallback, txnId?: number, expectedVersion?: number): number;
2381
+ /**
2382
+ * Reads on the thread pool, applying `expectedVersion` and `POPULATE_VERSION_FLAG` like
2383
+ * `getSync()`. It neither probes the block cache nor answers from the verification table first:
2384
+ * the caller has already done both with `getSync(..., ONLY_IF_IN_MEMORY_CACHE_FLAG)`.
2385
+ *
2386
+ * Note that keyLengthOrKeyBuffer can be the length of the key if it was written into the shared
2387
+ * buffer, or a direct buffer.
2388
+ */
2389
+ get(keyLengthOrKeyBuffer: number | Buffer, resolve: ResolveCallback<Buffer | number>, reject: RejectCallback, txnId?: number, expectedVersion?: number, flags?: number): number;
2334
2390
  estimateCount(startKey?: Buffer, endKey?: Buffer): {
2335
2391
  count: number;
2336
2392
  confidence: number;
@@ -2445,6 +2501,19 @@ type RocksDatabaseConfig = {
2445
2501
  */
2446
2502
  verificationTableEntries?: number;
2447
2503
  compactOnClose?: boolean;
2504
+ /**
2505
+ * Whether the main thread runs `shutdown()` from a `process.on('exit')`
2506
+ * listener it registers when rocksdb-js loads, so `process.exit()` does
2507
+ * not skip the flush. Defaults to `true`. After it runs, databases are
2508
+ * closed and opening one throws, so an `exit` listener that still needs a
2509
+ * database must be added with `process.prependListener`. If data may be
2510
+ * left unflushed (a timed-out shutdown, or a failed final flush), it sets
2511
+ * `process.exitCode` to 1 unless it is already nonzero. Like the cleanup on a natural exit, it waits for in-flight native
2512
+ * work (a commit, flush, or backup) without a time limit. Set to `false` to
2513
+ * leave memtables unflushed at a Node `process.exit()`, e.g. to exercise
2514
+ * crash recovery; a natural exit still flushes from the native cleanup hook.
2515
+ */
2516
+ shutdownOnExit?: boolean;
2448
2517
  /**
2449
2518
  * Maximum seconds an open, destroy, or shutdown call waits for another
2450
2519
  * lifecycle operation. Defaults to 30.
@@ -2692,7 +2761,7 @@ export declare const getRegistryStatus: () => RegistryStatus;
2692
2761
  */
2693
2762
  export declare const registryStatus: () => RegistryStatus;
2694
2763
  /**
2695
- * Flushes every open database and waits for outstanding compactions, then
2764
+ * Flushes every open database and cancels its outstanding compactions, then
2696
2765
  * releases the registry.
2697
2766
  *
2698
2767
  * **Throws** the first failure it encounters: a close whose native teardown
@@ -2702,19 +2771,10 @@ export declare const registryStatus: () => RegistryStatus;
2702
2771
  * `database:closeFailed`; a timeout has no event, so the throw is its only
2703
2772
  * signal.
2704
2773
  *
2705
- * A `process.on('exit')` listener must therefore wrap it: an exception thrown
2706
- * from an `exit` listener skips every `exit` listener registered after it (and
2707
- * sets exit code 1 unless an `uncaughtException` handler is installed).
2708
- *
2709
- * ```typescript
2710
- * process.on('exit', () => {
2711
- * try {
2712
- * shutdown();
2713
- * } catch (error) {
2714
- * console.error('rocksdb-js shutdown failed', error);
2715
- * }
2716
- * });
2717
- * ```
2774
+ * You do not need to call it at exit: when rocksdb-js loads on the main
2775
+ * thread it registers a `process.on('exit')` listener that does the same and
2776
+ * reports failures to stderr and the exit code instead of throwing (see the
2777
+ * `shutdownOnExit` config option). Calling it yourself as well is safe.
2718
2778
  */
2719
2779
  export declare const shutdown: () => void;
2720
2780
  export declare const currentThreadId: () => number;
@@ -2733,6 +2793,30 @@ export declare const currentThreadId: () => number;
2733
2793
  * platform-defined. No open database is needed.
2734
2794
  */
2735
2795
  export declare const steadyClockNow: () => number;
2796
+ /**
2797
+ * Raises the process-wide monotonic timestamp clock — the one behind
2798
+ * `db.getMonotonicTimestamp()`, every transaction's initial timestamp and so
2799
+ * every transaction-log batch key — to at least `timestamp` (Unix epoch
2800
+ * milliseconds). Every timestamp the process issues after the call is strictly
2801
+ * greater than `timestamp`, across every database and `worker_threads` worker.
2802
+ * Timestamps already issued and timestamps adopted with `txn.setTimestamp()`
2803
+ * are unaffected. No open database is needed.
2804
+ *
2805
+ * Use it to carry a floor the caller persisted across a restart, which a
2806
+ * backward wall-clock step would otherwise let the new process reissue. The
2807
+ * floor is in memory only and is not a fence: restore it before the process
2808
+ * starts any transaction it originates, and pass only floors this node
2809
+ * persisted itself, since the clock stays that far ahead until wall time
2810
+ * catches up.
2811
+ *
2812
+ * @returns `true` if the clock was raised: `timestamp` was ahead of both the
2813
+ * wall clock and every timestamp already issued. `false` if the clock was
2814
+ * already at or above it.
2815
+ * @throws {TypeError} If `timestamp` is not a number.
2816
+ * @throws {RangeError} If `timestamp` is not finite, is not greater than 0, is
2817
+ * not less than 8.64e15, or is more than ten years ahead of the wall clock.
2818
+ */
2819
+ export declare const raiseTimestampFloor: (timestamp: number) => boolean;
2736
2820
  /**
2737
2821
  * Advises the kernel that the file-backed pages of every mapped transaction log
2738
2822
  * are cold (Linux MADV_COLD), so they are reclaimed first under memory pressure
@@ -3753,9 +3837,14 @@ export declare class TransactionLogGapError extends Error {
3753
3837
  unavailableLogCount: number;
3754
3838
  constructor(logId: number, resumeLogId: number, unavailableLogCount: number);
3755
3839
  }
3840
+ /** Readable input ended before the iterator's physical `until` bound. Retry after input is available. */
3841
+ export declare class TransactionLogUntilUnreachedError extends Error {
3842
+ logId: number;
3843
+ position: number;
3844
+ constructor(logId: number, position: number);
3845
+ }
3756
3846
  export declare const versions: {
3757
3847
  rocksdb: string;
3758
3848
  "rocksdb-js": string;
3759
3849
  };
3760
- export type { BackgroundErrorOptions, BackupInfo, BackupOptions, BackupStreamOptions, CompressionAlgorithm, CompressionInfo, CompressionOption, CountEstimate, CountEstimateOptions, CountEstimatorOptions, FlushOptions, GetStatsMethod, IteratorOptions, Key, LogOptions, RestoreMode, RestoreOptions, RocksDBStat, RocksDBStats, RocksDatabaseOptions, StatsAll, StatsAllExtras, StatsBasics, StatsCurated, StatsCuratedExtras, StatsDefault, StatsHistogramData, StatsValue, StoreContext, StoreGetOptions, StoreIteratorOptions, StorePutOptions, StoreRangeOptions, StoreRemoveOptions, TransactionEntry, TransactionLogFileValidation, TransactionLogPosition, TransactionLogStats, TransactionLogStoreValidation, ValidateTransactionLogStoreOptions, WriteBufferManagerFlushPolicy, WriteBufferManagerStats };
3761
- //# sourceMappingURL=index.d.cts.map
3850
+ export type { BackgroundErrorOptions, BackupInfo, BackupOptions, BackupStreamOptions, CompressionAlgorithm, CompressionInfo, CompressionOption, CountEstimate, CountEstimateOptions, CountEstimatorOptions, FlushOptions, GetStatsMethod, IteratorOptions, Key, LogOptions, RestoreMode, RestoreOptions, RocksDBStat, RocksDBStats, RocksDatabaseOptions, StatsAll, StatsAllExtras, StatsBasics, StatsCurated, StatsCuratedExtras, StatsDefault, StatsHistogramData, StatsValue, StoreContext, StoreGetOptions, StoreIteratorOptions, StorePutOptions, StoreRangeOptions, StoreRemoveOptions, TransactionEntry, TransactionLogFileValidation, TransactionLogIterator, TransactionLogPosition, TransactionLogPurgeWatermark, TransactionLogStats, TransactionLogStoreValidation, ValidateTransactionLogStoreOptions, WriteBufferManagerFlushPolicy, WriteBufferManagerStats };
package/dist/index.d.mts CHANGED
@@ -682,6 +682,10 @@ export declare class Store {
682
682
  * The memtable arena block size in bytes; `0` or unset is automatic.
683
683
  */
684
684
  arenaBlockSize?: number;
685
+ /**
686
+ * Bits per key of the whole-key filter in each SST; `0` disables filters.
687
+ */
688
+ bloomFilterBitsPerKey?: number;
685
689
  /**
686
690
  * The function used to encode keys using the shared `keyBuffer`.
687
691
  */
@@ -901,6 +905,9 @@ interface GetOptions {
901
905
  * When `true`, after a DB read the native layer automatically seeds the
902
906
  * verification-table slot with the version extracted from the value.
903
907
  * Eliminates the need for a separate `populateVersion` call on cold reads.
908
+ * Seeds nothing unless this handle participates in the verification
909
+ * table: opened with `verificationTable: true`, or opened without the
910
+ * option on a column family another handle opened with it.
904
911
  *
905
912
  * @default false
906
913
  */
@@ -1990,7 +1997,7 @@ type NativeTransaction = {
1990
1997
  abort(): void;
1991
1998
  commit(resolve: (retrySignal?: number) => void, reject: (err: Error) => void): void;
1992
1999
  commitSync(): void;
1993
- get(keyLengthOrKeyBuffer: number | Buffer, resolve: (value: Buffer | number) => void, reject: (err: Error) => void, txnIdIgnored?: number, expectedVersion?: number): number;
2000
+ get(keyLengthOrKeyBuffer: number | Buffer, resolve: (value: Buffer | number) => void, reject: (err: Error) => void, txnIdIgnored?: number, expectedVersion?: number, flags?: number): number;
1994
2001
  getCount(options?: RangeOptions): number;
1995
2002
  getSync(keyLengthOrKeyBuffer: number | Buffer): Buffer | number | undefined;
1996
2003
  getTimestamp(): number;
@@ -2016,7 +2023,20 @@ type TransactionLogQueryOptions = {
2016
2023
  startFromLastFlushed?: boolean;
2017
2024
  readUncommitted?: boolean;
2018
2025
  exclusiveStart?: boolean;
2026
+ /**
2027
+ * Stop before this same-log iterator's unread position, including a peeked entry.
2028
+ * Resumes when it advances; a closed iterator no longer bounds this query.
2029
+ * A pull short of the bound throws TransactionLogUntilUnreachedError.
2030
+ * Invalid or foreign-log iterators throw TypeError at query creation.
2031
+ */
2032
+ until?: TransactionLogIterator;
2019
2033
  };
2034
+ interface TransactionLogIterator extends IterableIterator<TransactionEntry> {
2035
+ /** Inspect the next entry without consuming it. A done result is never cached. */
2036
+ peek(): IteratorResult<TransactionEntry>;
2037
+ /** Permanently end this iterator and release any iterators bounded by it. */
2038
+ close(): void;
2039
+ }
2020
2040
  type TransactionEntry = {
2021
2041
  timestamp: number;
2022
2042
  data: Buffer;
@@ -2093,14 +2113,33 @@ type TransactionLogStats = {
2093
2113
  maxAgeThreshold: number;
2094
2114
  };
2095
2115
  };
2116
+ /**
2117
+ * Returned by {@link TransactionLog.getPurgeWatermark}. When `known`, `purgedThrough` is at or above
2118
+ * every entry key in every file deleted from the log (0 when none was). `known` is false when that
2119
+ * cannot be vouched for, such as a log created by a release without the watermark.
2120
+ */
2121
+ type TransactionLogPurgeWatermark = {
2122
+ known: true;
2123
+ purgedThrough: number;
2124
+ } | {
2125
+ known: false;
2126
+ };
2096
2127
  export type TransactionLog = {
2097
2128
  new (db: NativeDatabase, name: string): TransactionLog;
2098
2129
  addEntry(data: Buffer | Uint8Array, txnId?: number): void;
2130
+ /**
2131
+ * Whether `other` is the same logical log: the same database identity and log name.
2132
+ * Works after either database closes. A log destroyed and recreated under the same name
2133
+ * still compares equal.
2134
+ * Throws a TypeError when called on a receiver that is not a TransactionLog.
2135
+ */
2136
+ equals(other: unknown): boolean;
2099
2137
  getLogFileSize(sequenceId?: number): number;
2138
+ getPurgeWatermark(): TransactionLogPurgeWatermark;
2100
2139
  getStats(): TransactionLogStats;
2101
2140
  name: string;
2102
2141
  path: string;
2103
- query(options?: TransactionLogQueryOptions): IterableIterator<TransactionEntry>;
2142
+ query(options?: TransactionLogQueryOptions): TransactionLogIterator;
2104
2143
  _currentLogBuffer: WeakRef<LogBuffer> | undefined;
2105
2144
  _findPosition(timestamp: number): number;
2106
2145
  _findExactStart(timestamp: number, span: Float64Array): number;
@@ -2155,6 +2194,12 @@ type NativeDatabaseOptions = {
2155
2194
  * `min(1 MiB, writeBufferSize / 8)`.
2156
2195
  */
2157
2196
  arenaBlockSize?: number;
2197
+ /**
2198
+ * Bits per key of the whole-key filter written into each SST file (default
2199
+ * `10`, about a 1% false-positive rate); `0` writes no filter. Otherwise
2200
+ * 1 to 100, fractions allowed.
2201
+ */
2202
+ bloomFilterBitsPerKey?: number;
2158
2203
  /**
2159
2204
  * The friendly name of a compression algorithm compiled into this RocksDB
2160
2205
  * build (see `supportedCompression`), e.g. `'lz4'`, `'zstd'`, `'none'`. The
@@ -2239,7 +2284,10 @@ type NativeDatabaseOptions = {
2239
2284
  * When true, transaction writes to this column family invalidate the
2240
2285
  * VerificationTable slot for each written key at write time (not at
2241
2286
  * commit time). Enable only for column families whose records are
2242
- * cached (e.g. the primary CF of a table). Default: false.
2287
+ * cached (e.g. the primary CF of a table). Default: false. Left unset, a
2288
+ * handle joins a column family another handle opened with `true`; an
2289
+ * explicit `false` throws `ERR_VERIFICATION_TABLE_CONFLICT` while any
2290
+ * handle on that column family participates.
2243
2291
  */
2244
2292
  verificationTable?: boolean;
2245
2293
  writeBufferSize?: number;
@@ -2330,7 +2378,15 @@ type NativeDatabase = {
2330
2378
  flushSync(options?: FlushOptions): void;
2331
2379
  syncWal(resolve: ResolveCallback<void>, reject: RejectCallback): void;
2332
2380
  notify(event: string | BufferWithDataView, args?: any[]): boolean;
2333
- get(keyLengthOrKeyBuffer: number | Buffer, resolve: ResolveCallback<Buffer | number>, reject: RejectCallback, txnId?: number, expectedVersion?: number): number;
2381
+ /**
2382
+ * Reads on the thread pool, applying `expectedVersion` and `POPULATE_VERSION_FLAG` like
2383
+ * `getSync()`. It neither probes the block cache nor answers from the verification table first:
2384
+ * the caller has already done both with `getSync(..., ONLY_IF_IN_MEMORY_CACHE_FLAG)`.
2385
+ *
2386
+ * Note that keyLengthOrKeyBuffer can be the length of the key if it was written into the shared
2387
+ * buffer, or a direct buffer.
2388
+ */
2389
+ get(keyLengthOrKeyBuffer: number | Buffer, resolve: ResolveCallback<Buffer | number>, reject: RejectCallback, txnId?: number, expectedVersion?: number, flags?: number): number;
2334
2390
  estimateCount(startKey?: Buffer, endKey?: Buffer): {
2335
2391
  count: number;
2336
2392
  confidence: number;
@@ -2445,6 +2501,19 @@ type RocksDatabaseConfig = {
2445
2501
  */
2446
2502
  verificationTableEntries?: number;
2447
2503
  compactOnClose?: boolean;
2504
+ /**
2505
+ * Whether the main thread runs `shutdown()` from a `process.on('exit')`
2506
+ * listener it registers when rocksdb-js loads, so `process.exit()` does
2507
+ * not skip the flush. Defaults to `true`. After it runs, databases are
2508
+ * closed and opening one throws, so an `exit` listener that still needs a
2509
+ * database must be added with `process.prependListener`. If data may be
2510
+ * left unflushed (a timed-out shutdown, or a failed final flush), it sets
2511
+ * `process.exitCode` to 1 unless it is already nonzero. Like the cleanup on a natural exit, it waits for in-flight native
2512
+ * work (a commit, flush, or backup) without a time limit. Set to `false` to
2513
+ * leave memtables unflushed at a Node `process.exit()`, e.g. to exercise
2514
+ * crash recovery; a natural exit still flushes from the native cleanup hook.
2515
+ */
2516
+ shutdownOnExit?: boolean;
2448
2517
  /**
2449
2518
  * Maximum seconds an open, destroy, or shutdown call waits for another
2450
2519
  * lifecycle operation. Defaults to 30.
@@ -2692,7 +2761,7 @@ export declare const getRegistryStatus: () => RegistryStatus;
2692
2761
  */
2693
2762
  export declare const registryStatus: () => RegistryStatus;
2694
2763
  /**
2695
- * Flushes every open database and waits for outstanding compactions, then
2764
+ * Flushes every open database and cancels its outstanding compactions, then
2696
2765
  * releases the registry.
2697
2766
  *
2698
2767
  * **Throws** the first failure it encounters: a close whose native teardown
@@ -2702,19 +2771,10 @@ export declare const registryStatus: () => RegistryStatus;
2702
2771
  * `database:closeFailed`; a timeout has no event, so the throw is its only
2703
2772
  * signal.
2704
2773
  *
2705
- * A `process.on('exit')` listener must therefore wrap it: an exception thrown
2706
- * from an `exit` listener skips every `exit` listener registered after it (and
2707
- * sets exit code 1 unless an `uncaughtException` handler is installed).
2708
- *
2709
- * ```typescript
2710
- * process.on('exit', () => {
2711
- * try {
2712
- * shutdown();
2713
- * } catch (error) {
2714
- * console.error('rocksdb-js shutdown failed', error);
2715
- * }
2716
- * });
2717
- * ```
2774
+ * You do not need to call it at exit: when rocksdb-js loads on the main
2775
+ * thread it registers a `process.on('exit')` listener that does the same and
2776
+ * reports failures to stderr and the exit code instead of throwing (see the
2777
+ * `shutdownOnExit` config option). Calling it yourself as well is safe.
2718
2778
  */
2719
2779
  export declare const shutdown: () => void;
2720
2780
  export declare const currentThreadId: () => number;
@@ -2733,6 +2793,30 @@ export declare const currentThreadId: () => number;
2733
2793
  * platform-defined. No open database is needed.
2734
2794
  */
2735
2795
  export declare const steadyClockNow: () => number;
2796
+ /**
2797
+ * Raises the process-wide monotonic timestamp clock — the one behind
2798
+ * `db.getMonotonicTimestamp()`, every transaction's initial timestamp and so
2799
+ * every transaction-log batch key — to at least `timestamp` (Unix epoch
2800
+ * milliseconds). Every timestamp the process issues after the call is strictly
2801
+ * greater than `timestamp`, across every database and `worker_threads` worker.
2802
+ * Timestamps already issued and timestamps adopted with `txn.setTimestamp()`
2803
+ * are unaffected. No open database is needed.
2804
+ *
2805
+ * Use it to carry a floor the caller persisted across a restart, which a
2806
+ * backward wall-clock step would otherwise let the new process reissue. The
2807
+ * floor is in memory only and is not a fence: restore it before the process
2808
+ * starts any transaction it originates, and pass only floors this node
2809
+ * persisted itself, since the clock stays that far ahead until wall time
2810
+ * catches up.
2811
+ *
2812
+ * @returns `true` if the clock was raised: `timestamp` was ahead of both the
2813
+ * wall clock and every timestamp already issued. `false` if the clock was
2814
+ * already at or above it.
2815
+ * @throws {TypeError} If `timestamp` is not a number.
2816
+ * @throws {RangeError} If `timestamp` is not finite, is not greater than 0, is
2817
+ * not less than 8.64e15, or is more than ten years ahead of the wall clock.
2818
+ */
2819
+ export declare const raiseTimestampFloor: (timestamp: number) => boolean;
2736
2820
  /**
2737
2821
  * Advises the kernel that the file-backed pages of every mapped transaction log
2738
2822
  * are cold (Linux MADV_COLD), so they are reclaimed first under memory pressure
@@ -3753,9 +3837,14 @@ export declare class TransactionLogGapError extends Error {
3753
3837
  unavailableLogCount: number;
3754
3838
  constructor(logId: number, resumeLogId: number, unavailableLogCount: number);
3755
3839
  }
3840
+ /** Readable input ended before the iterator's physical `until` bound. Retry after input is available. */
3841
+ export declare class TransactionLogUntilUnreachedError extends Error {
3842
+ logId: number;
3843
+ position: number;
3844
+ constructor(logId: number, position: number);
3845
+ }
3756
3846
  export declare const versions: {
3757
3847
  rocksdb: string;
3758
3848
  "rocksdb-js": string;
3759
3849
  };
3760
- export type { BackgroundErrorOptions, BackupInfo, BackupOptions, BackupStreamOptions, CompressionAlgorithm, CompressionInfo, CompressionOption, CountEstimate, CountEstimateOptions, CountEstimatorOptions, FlushOptions, GetStatsMethod, IteratorOptions, Key, LogOptions, RestoreMode, RestoreOptions, RocksDBStat, RocksDBStats, RocksDatabaseOptions, StatsAll, StatsAllExtras, StatsBasics, StatsCurated, StatsCuratedExtras, StatsDefault, StatsHistogramData, StatsValue, StoreContext, StoreGetOptions, StoreIteratorOptions, StorePutOptions, StoreRangeOptions, StoreRemoveOptions, TransactionEntry, TransactionLogFileValidation, TransactionLogPosition, TransactionLogStats, TransactionLogStoreValidation, ValidateTransactionLogStoreOptions, WriteBufferManagerFlushPolicy, WriteBufferManagerStats };
3761
- //# sourceMappingURL=index.d.mts.map
3850
+ export type { BackgroundErrorOptions, BackupInfo, BackupOptions, BackupStreamOptions, CompressionAlgorithm, CompressionInfo, CompressionOption, CountEstimate, CountEstimateOptions, CountEstimatorOptions, FlushOptions, GetStatsMethod, IteratorOptions, Key, LogOptions, RestoreMode, RestoreOptions, RocksDBStat, RocksDBStats, RocksDatabaseOptions, StatsAll, StatsAllExtras, StatsBasics, StatsCurated, StatsCuratedExtras, StatsDefault, StatsHistogramData, StatsValue, StoreContext, StoreGetOptions, StoreIteratorOptions, StorePutOptions, StoreRangeOptions, StoreRemoveOptions, TransactionEntry, TransactionLogFileValidation, TransactionLogIterator, TransactionLogPosition, TransactionLogPurgeWatermark, TransactionLogStats, TransactionLogStoreValidation, ValidateTransactionLogStoreOptions, WriteBufferManagerFlushPolicy, WriteBufferManagerStats };