@harperfast/rocksdb-js 1.5.0 → 2.1.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 +80 -19
- package/dist/index.cjs +4 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +443 -19
- package/dist/index.d.mts +443 -19
- package/dist/index.mjs +4 -16
- package/dist/index.mjs.map +1 -1
- package/docs/stats.md +459 -0
- package/docs/transaction-log.md +279 -0
- package/package.json +25 -24
package/dist/index.d.mts
CHANGED
|
@@ -30,6 +30,374 @@ type KeyEncoding = "binary" | "ordered-binary" | "uint32";
|
|
|
30
30
|
type ReadKeyFunction<T> = (source: BufferWithDataView, start: number, end?: number) => T;
|
|
31
31
|
type WriteKeyFunction = (key: Key, target: BufferWithDataView, start: number) => number;
|
|
32
32
|
//#endregion
|
|
33
|
+
//#region src/stats.d.ts
|
|
34
|
+
/** Database-level RocksDB statistics types for `db.getStats()` / `db.getStat()`. */
|
|
35
|
+
type StatsHistogramData = {
|
|
36
|
+
average: number;
|
|
37
|
+
count: number;
|
|
38
|
+
max: number;
|
|
39
|
+
median: number;
|
|
40
|
+
min: number;
|
|
41
|
+
percentile95: number;
|
|
42
|
+
percentile99: number;
|
|
43
|
+
standardDeviation: number;
|
|
44
|
+
sum: number;
|
|
45
|
+
};
|
|
46
|
+
type StatsBasics = {
|
|
47
|
+
"rocksdb.num-immutable-mem-table": number;
|
|
48
|
+
"rocksdb.num-immutable-mem-table-flushed": number;
|
|
49
|
+
"rocksdb.mem-table-flush-pending": number;
|
|
50
|
+
"rocksdb.cur-size-active-mem-table": number;
|
|
51
|
+
"rocksdb.cur-size-all-mem-tables": number;
|
|
52
|
+
"rocksdb.size-all-mem-tables": number;
|
|
53
|
+
"rocksdb.num-entries-active-mem-table": number;
|
|
54
|
+
"rocksdb.num-deletes-active-mem-table": number;
|
|
55
|
+
"rocksdb.compaction-pending": number;
|
|
56
|
+
"rocksdb.estimate-pending-compaction-bytes": number;
|
|
57
|
+
"rocksdb.num-running-compactions": number;
|
|
58
|
+
"rocksdb.num-running-flushes": number;
|
|
59
|
+
"rocksdb.total-sst-files-size": number;
|
|
60
|
+
"rocksdb.live-sst-files-size": number;
|
|
61
|
+
"rocksdb.estimate-live-data-size": number;
|
|
62
|
+
"rocksdb.estimate-num-keys": number;
|
|
63
|
+
"rocksdb.block-cache-capacity": number;
|
|
64
|
+
"rocksdb.block-cache-usage": number;
|
|
65
|
+
"rocksdb.block-cache-pinned-usage": number;
|
|
66
|
+
"rocksdb.num-live-versions": number;
|
|
67
|
+
"rocksdb.current-super-version-number": number;
|
|
68
|
+
"rocksdb.oldest-snapshot-time": number;
|
|
69
|
+
"rocksdb.num-blob-files": number;
|
|
70
|
+
"rocksdb.total-blob-file-size": number;
|
|
71
|
+
"rocksdb.live-blob-file-size": number;
|
|
72
|
+
"txnlog.logCount": number;
|
|
73
|
+
"txnlog.fileCount": number;
|
|
74
|
+
"txnlog.totalSizeBytes": number;
|
|
75
|
+
"txnlog.mappedBytes": number;
|
|
76
|
+
"txnlog.overlayBytes": number;
|
|
77
|
+
"txnlog.activeMaps": number;
|
|
78
|
+
"txnlog.pendingTransactions": number;
|
|
79
|
+
"txnlog.uncommittedTransactions": number;
|
|
80
|
+
"txnlog.transactionsWritten": number;
|
|
81
|
+
"txnlog.bytesWritten": number;
|
|
82
|
+
"txnlog.replayGapBytes": number;
|
|
83
|
+
};
|
|
84
|
+
type StatsCuratedExtras = {
|
|
85
|
+
"rocksdb.block.cache.hit": number;
|
|
86
|
+
"rocksdb.block.cache.miss": number;
|
|
87
|
+
"rocksdb.block.cache.data.hit": number;
|
|
88
|
+
"rocksdb.block.cache.data.miss": number;
|
|
89
|
+
"rocksdb.block.cache.index.hit": number;
|
|
90
|
+
"rocksdb.block.cache.index.miss": number;
|
|
91
|
+
"rocksdb.block.cache.filter.hit": number;
|
|
92
|
+
"rocksdb.block.cache.filter.miss": number;
|
|
93
|
+
"rocksdb.bloom.filter.useful": number;
|
|
94
|
+
"rocksdb.bloom.filter.full.positive": number;
|
|
95
|
+
"rocksdb.bloom.filter.full.true.positive": number;
|
|
96
|
+
"rocksdb.db.iter.bytes.read": number;
|
|
97
|
+
"rocksdb.number.reseeks.iteration": number;
|
|
98
|
+
"rocksdb.number.keys.read": number;
|
|
99
|
+
"rocksdb.number.keys.written": number;
|
|
100
|
+
"rocksdb.bytes.read": number;
|
|
101
|
+
"rocksdb.bytes.written": number;
|
|
102
|
+
"rocksdb.memtable.hit": number;
|
|
103
|
+
"rocksdb.memtable.miss": number;
|
|
104
|
+
"rocksdb.txn.overhead.mutex.prepare": number;
|
|
105
|
+
"rocksdb.txn.overhead.mutex.old.commit.map": number;
|
|
106
|
+
"rocksdb.txn.overhead.mutex.snapshot": number;
|
|
107
|
+
"rocksdb.compact.read.bytes": number;
|
|
108
|
+
"rocksdb.compact.write.bytes": number;
|
|
109
|
+
"rocksdb.compaction.cancelled": number;
|
|
110
|
+
"rocksdb.stall.micros": number;
|
|
111
|
+
"rocksdb.no.file.errors": number;
|
|
112
|
+
"rocksdb.read.amp.estimate.useful.bytes": number;
|
|
113
|
+
"rocksdb.read.amp.total.read.bytes": number;
|
|
114
|
+
"rocksdb.db.get.micros": StatsHistogramData;
|
|
115
|
+
"rocksdb.db.write.micros": StatsHistogramData;
|
|
116
|
+
"rocksdb.db.seek.micros": StatsHistogramData;
|
|
117
|
+
"rocksdb.db.flush.micros": StatsHistogramData;
|
|
118
|
+
"rocksdb.db.write.stall": StatsHistogramData;
|
|
119
|
+
"rocksdb.blobdb.value.size": StatsHistogramData;
|
|
120
|
+
"rocksdb.sst.read.micros": StatsHistogramData;
|
|
121
|
+
"rocksdb.compaction.times.micros": StatsHistogramData;
|
|
122
|
+
};
|
|
123
|
+
type StatsAllExtras = {
|
|
124
|
+
"rocksdb.block.cache.add": number;
|
|
125
|
+
"rocksdb.block.cache.add.failures": number;
|
|
126
|
+
"rocksdb.block.cache.index.add": number;
|
|
127
|
+
"rocksdb.block.cache.index.bytes.insert": number;
|
|
128
|
+
"rocksdb.block.cache.filter.add": number;
|
|
129
|
+
"rocksdb.block.cache.filter.bytes.insert": number;
|
|
130
|
+
"rocksdb.block.cache.data.add": number;
|
|
131
|
+
"rocksdb.block.cache.data.bytes.insert": number;
|
|
132
|
+
"rocksdb.block.cache.bytes.read": number;
|
|
133
|
+
"rocksdb.block.cache.bytes.write": number;
|
|
134
|
+
"rocksdb.block.cache.compression.dict.miss": number;
|
|
135
|
+
"rocksdb.block.cache.compression.dict.hit": number;
|
|
136
|
+
"rocksdb.block.cache.compression.dict.add": number;
|
|
137
|
+
"rocksdb.block.cache.compression.dict.bytes.insert": number;
|
|
138
|
+
"rocksdb.block.cache.add.redundant": number;
|
|
139
|
+
"rocksdb.block.cache.index.add.redundant": number;
|
|
140
|
+
"rocksdb.block.cache.filter.add.redundant": number;
|
|
141
|
+
"rocksdb.block.cache.data.add.redundant": number;
|
|
142
|
+
"rocksdb.block.cache.compression.dict.add.redundant": number;
|
|
143
|
+
"rocksdb.secondary.cache.hits": number;
|
|
144
|
+
"rocksdb.secondary.cache.filter.hits": number;
|
|
145
|
+
"rocksdb.secondary.cache.index.hits": number;
|
|
146
|
+
"rocksdb.secondary.cache.data.hits": number;
|
|
147
|
+
"rocksdb.compressed.secondary.cache.dummy.hits": number;
|
|
148
|
+
"rocksdb.compressed.secondary.cache.hits": number;
|
|
149
|
+
"rocksdb.compressed.secondary.cache.promotions": number;
|
|
150
|
+
"rocksdb.compressed.secondary.cache.promotion.skips": number;
|
|
151
|
+
"rocksdb.bloom.filter.prefix.checked": number;
|
|
152
|
+
"rocksdb.bloom.filter.prefix.useful": number;
|
|
153
|
+
"rocksdb.bloom.filter.prefix.true.positive": number;
|
|
154
|
+
"rocksdb.persistent.cache.hit": number;
|
|
155
|
+
"rocksdb.persistent.cache.miss": number;
|
|
156
|
+
"rocksdb.sim.block.cache.hit": number;
|
|
157
|
+
"rocksdb.sim.block.cache.miss": number;
|
|
158
|
+
"rocksdb.l0.hit": number;
|
|
159
|
+
"rocksdb.l1.hit": number;
|
|
160
|
+
"rocksdb.l2andup.hit": number;
|
|
161
|
+
"rocksdb.compaction.key.drop.new": number;
|
|
162
|
+
"rocksdb.compaction.key.drop.obsolete": number;
|
|
163
|
+
"rocksdb.compaction.key.drop.range_del": number;
|
|
164
|
+
"rocksdb.compaction.key.drop.user": number;
|
|
165
|
+
"rocksdb.compaction.range_del.drop.obsolete": number;
|
|
166
|
+
"rocksdb.compaction.optimized.del.drop.obsolete": number;
|
|
167
|
+
"rocksdb.compaction.aborted": number;
|
|
168
|
+
"rocksdb.number.keys.updated": number;
|
|
169
|
+
"rocksdb.number.db.seek": number;
|
|
170
|
+
"rocksdb.number.db.next": number;
|
|
171
|
+
"rocksdb.number.db.prev": number;
|
|
172
|
+
"rocksdb.number.db.seek.found": number;
|
|
173
|
+
"rocksdb.number.db.next.found": number;
|
|
174
|
+
"rocksdb.number.db.prev.found": number;
|
|
175
|
+
"rocksdb.number.iter.skip": number;
|
|
176
|
+
"rocksdb.num.iterator.created": number;
|
|
177
|
+
"rocksdb.num.iterator.deleted": number;
|
|
178
|
+
"rocksdb.no.file.opens": number;
|
|
179
|
+
"rocksdb.db.mutex.wait.micros": number;
|
|
180
|
+
"rocksdb.number.multiget.get": number;
|
|
181
|
+
"rocksdb.number.multiget.keys.read": number;
|
|
182
|
+
"rocksdb.number.multiget.bytes.read": number;
|
|
183
|
+
"rocksdb.number.multiget.keys.found": number;
|
|
184
|
+
"rocksdb.number.merge.failures": number;
|
|
185
|
+
"rocksdb.getupdatessince.calls": number;
|
|
186
|
+
"rocksdb.wal.synced": number;
|
|
187
|
+
"rocksdb.wal.bytes": number;
|
|
188
|
+
"rocksdb.write.self": number;
|
|
189
|
+
"rocksdb.write.other": number;
|
|
190
|
+
"rocksdb.write.wal": number;
|
|
191
|
+
"rocksdb.flush.write.bytes": number;
|
|
192
|
+
"rocksdb.compact.read.marked.bytes": number;
|
|
193
|
+
"rocksdb.compact.read.periodic.bytes": number;
|
|
194
|
+
"rocksdb.compact.read.ttl.bytes": number;
|
|
195
|
+
"rocksdb.compact.write.marked.bytes": number;
|
|
196
|
+
"rocksdb.compact.write.periodic.bytes": number;
|
|
197
|
+
"rocksdb.compact.write.ttl.bytes": number;
|
|
198
|
+
"rocksdb.number.direct.load.table.properties": number;
|
|
199
|
+
"rocksdb.number.superversion_acquires": number;
|
|
200
|
+
"rocksdb.number.superversion_releases": number;
|
|
201
|
+
"rocksdb.number.superversion_cleanups": number;
|
|
202
|
+
"rocksdb.number.block.compressed": number;
|
|
203
|
+
"rocksdb.number.block.decompressed": number;
|
|
204
|
+
"rocksdb.bytes.compressed.from": number;
|
|
205
|
+
"rocksdb.bytes.compressed.to": number;
|
|
206
|
+
"rocksdb.bytes.compression_bypassed": number;
|
|
207
|
+
"rocksdb.bytes.compression.rejected": number;
|
|
208
|
+
"rocksdb.number.block_compression_bypassed": number;
|
|
209
|
+
"rocksdb.number.block_compression_rejected": number;
|
|
210
|
+
"rocksdb.bytes.decompressed.from": number;
|
|
211
|
+
"rocksdb.bytes.decompressed.to": number;
|
|
212
|
+
"rocksdb.merge.operation.time.nanos": number;
|
|
213
|
+
"rocksdb.filter.operation.time.nanos": number;
|
|
214
|
+
"rocksdb.compaction.total.time.cpu_micros": number;
|
|
215
|
+
"rocksdb.row.cache.hit": number;
|
|
216
|
+
"rocksdb.row.cache.miss": number;
|
|
217
|
+
"rocksdb.number.rate_limiter.drains": number;
|
|
218
|
+
"rocksdb.blobdb.num.put": number;
|
|
219
|
+
"rocksdb.blobdb.num.write": number;
|
|
220
|
+
"rocksdb.blobdb.num.get": number;
|
|
221
|
+
"rocksdb.blobdb.num.multiget": number;
|
|
222
|
+
"rocksdb.blobdb.num.seek": number;
|
|
223
|
+
"rocksdb.blobdb.num.next": number;
|
|
224
|
+
"rocksdb.blobdb.num.prev": number;
|
|
225
|
+
"rocksdb.blobdb.num.keys.written": number;
|
|
226
|
+
"rocksdb.blobdb.num.keys.read": number;
|
|
227
|
+
"rocksdb.blobdb.bytes.written": number;
|
|
228
|
+
"rocksdb.blobdb.bytes.read": number;
|
|
229
|
+
"rocksdb.blobdb.write.inlined": number;
|
|
230
|
+
"rocksdb.blobdb.write.inlined.ttl": number;
|
|
231
|
+
"rocksdb.blobdb.write.blob": number;
|
|
232
|
+
"rocksdb.blobdb.write.blob.ttl": number;
|
|
233
|
+
"rocksdb.blobdb.blob.file.bytes.written": number;
|
|
234
|
+
"rocksdb.blobdb.blob.file.bytes.read": number;
|
|
235
|
+
"rocksdb.blobdb.blob.file.synced": number;
|
|
236
|
+
"rocksdb.blobdb.blob.index.expired.count": number;
|
|
237
|
+
"rocksdb.blobdb.blob.index.expired.size": number;
|
|
238
|
+
"rocksdb.blobdb.blob.index.evicted.count": number;
|
|
239
|
+
"rocksdb.blobdb.blob.index.evicted.size": number;
|
|
240
|
+
"rocksdb.blobdb.gc.num.files": number;
|
|
241
|
+
"rocksdb.blobdb.gc.num.new.files": number;
|
|
242
|
+
"rocksdb.blobdb.gc.failures": number;
|
|
243
|
+
"rocksdb.blobdb.gc.num.keys.relocated": number;
|
|
244
|
+
"rocksdb.blobdb.gc.bytes.relocated": number;
|
|
245
|
+
"rocksdb.blobdb.fifo.num.files.evicted": number;
|
|
246
|
+
"rocksdb.blobdb.fifo.num.keys.evicted": number;
|
|
247
|
+
"rocksdb.blobdb.fifo.bytes.evicted": number;
|
|
248
|
+
"rocksdb.blobdb.cache.miss": number;
|
|
249
|
+
"rocksdb.blobdb.cache.hit": number;
|
|
250
|
+
"rocksdb.blobdb.cache.add": number;
|
|
251
|
+
"rocksdb.blobdb.cache.add.failures": number;
|
|
252
|
+
"rocksdb.blobdb.cache.bytes.read": number;
|
|
253
|
+
"rocksdb.blobdb.cache.bytes.write": number;
|
|
254
|
+
"rocksdb.txn.overhead.duplicate.key": number;
|
|
255
|
+
"rocksdb.txn.get.tryagain": number;
|
|
256
|
+
"rocksdb.files.marked.trash": number;
|
|
257
|
+
"rocksdb.files.marked.trash.deleted": number;
|
|
258
|
+
"rocksdb.files.deleted.immediately": number;
|
|
259
|
+
"rocksdb.error.handler.bg.error.count": number;
|
|
260
|
+
"rocksdb.error.handler.bg.io.error.count": number;
|
|
261
|
+
"rocksdb.error.handler.bg.retryable.io.error.count": number;
|
|
262
|
+
"rocksdb.error.handler.autoresume.count": number;
|
|
263
|
+
"rocksdb.error.handler.autoresume.retry.total.count": number;
|
|
264
|
+
"rocksdb.error.handler.autoresume.success.count": number;
|
|
265
|
+
"rocksdb.memtable.payload.bytes.at.flush": number;
|
|
266
|
+
"rocksdb.memtable.garbage.bytes.at.flush": number;
|
|
267
|
+
"rocksdb.verify_checksum.read.bytes": number;
|
|
268
|
+
"rocksdb.backup.read.bytes": number;
|
|
269
|
+
"rocksdb.backup.write.bytes": number;
|
|
270
|
+
"rocksdb.remote.compact.read.bytes": number;
|
|
271
|
+
"rocksdb.remote.compact.write.bytes": number;
|
|
272
|
+
"rocksdb.remote.compact.resumed.bytes": number;
|
|
273
|
+
"rocksdb.hot.file.read.bytes": number;
|
|
274
|
+
"rocksdb.warm.file.read.bytes": number;
|
|
275
|
+
"rocksdb.cool.file.read.bytes": number;
|
|
276
|
+
"rocksdb.cold.file.read.bytes": number;
|
|
277
|
+
"rocksdb.ice.file.read.bytes": number;
|
|
278
|
+
"rocksdb.hot.file.read.count": number;
|
|
279
|
+
"rocksdb.warm.file.read.count": number;
|
|
280
|
+
"rocksdb.cool.file.read.count": number;
|
|
281
|
+
"rocksdb.cold.file.read.count": number;
|
|
282
|
+
"rocksdb.ice.file.read.count": number;
|
|
283
|
+
"rocksdb.last.level.read.bytes": number;
|
|
284
|
+
"rocksdb.last.level.read.count": number;
|
|
285
|
+
"rocksdb.non.last.level.read.bytes": number;
|
|
286
|
+
"rocksdb.non.last.level.read.count": number;
|
|
287
|
+
"rocksdb.last.level.seek.filtered": number;
|
|
288
|
+
"rocksdb.last.level.seek.filter.match": number;
|
|
289
|
+
"rocksdb.last.level.seek.data": number;
|
|
290
|
+
"rocksdb.last.level.seek.data.useful.no.filter": number;
|
|
291
|
+
"rocksdb.last.level.seek.data.useful.filter.match": number;
|
|
292
|
+
"rocksdb.non.last.level.seek.filtered": number;
|
|
293
|
+
"rocksdb.non.last.level.seek.filter.match": number;
|
|
294
|
+
"rocksdb.non.last.level.seek.data": number;
|
|
295
|
+
"rocksdb.non.last.level.seek.data.useful.no.filter": number;
|
|
296
|
+
"rocksdb.non.last.level.seek.data.useful.filter.match": number;
|
|
297
|
+
"rocksdb.block.checksum.compute.count": number;
|
|
298
|
+
"rocksdb.block.checksum.mismatch.count": number;
|
|
299
|
+
"rocksdb.multiget.coroutine.count": number;
|
|
300
|
+
"rocksdb.read.async.micros": number;
|
|
301
|
+
"rocksdb.async.read.error.count": number;
|
|
302
|
+
"rocksdb.table.open.prefetch.tail.miss": number;
|
|
303
|
+
"rocksdb.table.open.prefetch.tail.hit": number;
|
|
304
|
+
"rocksdb.timestamp.filter.table.checked": number;
|
|
305
|
+
"rocksdb.timestamp.filter.table.filtered": number;
|
|
306
|
+
"rocksdb.readahead.trimmed": number;
|
|
307
|
+
"rocksdb.fifo.max.size.compactions": number;
|
|
308
|
+
"rocksdb.fifo.ttl.compactions": number;
|
|
309
|
+
"rocksdb.fifo.change_temperature.compactions": number;
|
|
310
|
+
"rocksdb.prefetch.bytes": number;
|
|
311
|
+
"rocksdb.prefetch.bytes.useful": number;
|
|
312
|
+
"rocksdb.prefetch.hits": number;
|
|
313
|
+
"rocksdb.footer.corruption.count": number;
|
|
314
|
+
"rocksdb.file.read.corruption.retry.count": number;
|
|
315
|
+
"rocksdb.file.read.corruption.retry.success.count": number;
|
|
316
|
+
"rocksdb.number.wbwi.ingest": number;
|
|
317
|
+
"rocksdb.sst.user.defined.index.load.fail.count": number;
|
|
318
|
+
"rocksdb.multiscan.prepare.calls": number;
|
|
319
|
+
"rocksdb.multiscan.prepare.errors": number;
|
|
320
|
+
"rocksdb.multiscan.blocks.prefetched": number;
|
|
321
|
+
"rocksdb.multiscan.blocks.from.cache": number;
|
|
322
|
+
"rocksdb.multiscan.prefetch.bytes": number;
|
|
323
|
+
"rocksdb.multiscan.prefetch.blocks.wasted": number;
|
|
324
|
+
"rocksdb.multiscan.io.requests": number;
|
|
325
|
+
"rocksdb.multiscan.io.coalesced.nonadjacent": number;
|
|
326
|
+
"rocksdb.multiscan.seek.errors": number;
|
|
327
|
+
"rocksdb.prefetch.memory.bytes.granted": number;
|
|
328
|
+
"rocksdb.prefetch.memory.bytes.released": number;
|
|
329
|
+
"rocksdb.prefetch.memory.requests.blocked": number;
|
|
330
|
+
"rocksdb.compaction.times.cpu_micros": StatsHistogramData;
|
|
331
|
+
"rocksdb.subcompaction.setup.times.micros": StatsHistogramData;
|
|
332
|
+
"rocksdb.table.sync.micros": StatsHistogramData;
|
|
333
|
+
"rocksdb.compaction.outfile.sync.micros": StatsHistogramData;
|
|
334
|
+
"rocksdb.wal.file.sync.micros": StatsHistogramData;
|
|
335
|
+
"rocksdb.manifest.file.sync.micros": StatsHistogramData;
|
|
336
|
+
"rocksdb.table.open.io.micros": StatsHistogramData;
|
|
337
|
+
"rocksdb.db.multiget.micros": StatsHistogramData;
|
|
338
|
+
"rocksdb.read.block.compaction.micros": StatsHistogramData;
|
|
339
|
+
"rocksdb.read.block.get.micros": StatsHistogramData;
|
|
340
|
+
"rocksdb.write.raw.block.micros": StatsHistogramData;
|
|
341
|
+
"rocksdb.numfiles.in.singlecompaction": StatsHistogramData;
|
|
342
|
+
"rocksdb.file.read.flush.micros": StatsHistogramData;
|
|
343
|
+
"rocksdb.file.read.compaction.micros": StatsHistogramData;
|
|
344
|
+
"rocksdb.file.read.db.open.micros": StatsHistogramData;
|
|
345
|
+
"rocksdb.file.read.get.micros": StatsHistogramData;
|
|
346
|
+
"rocksdb.file.read.multiget.micros": StatsHistogramData;
|
|
347
|
+
"rocksdb.file.read.db.iterator.micros": StatsHistogramData;
|
|
348
|
+
"rocksdb.file.read.verify.db.checksum.micros": StatsHistogramData;
|
|
349
|
+
"rocksdb.file.read.verify.file.checksums.micros": StatsHistogramData;
|
|
350
|
+
"rocksdb.sst.write.micros": StatsHistogramData;
|
|
351
|
+
"rocksdb.file.write.flush.micros": StatsHistogramData;
|
|
352
|
+
"rocksdb.file.write.compaction.micros": StatsHistogramData;
|
|
353
|
+
"rocksdb.file.write.db.open.micros": StatsHistogramData;
|
|
354
|
+
"rocksdb.num.subcompactions.scheduled": StatsHistogramData;
|
|
355
|
+
"rocksdb.bytes.per.read": StatsHistogramData;
|
|
356
|
+
"rocksdb.bytes.per.write": StatsHistogramData;
|
|
357
|
+
"rocksdb.bytes.per.multiget": StatsHistogramData;
|
|
358
|
+
"rocksdb.compression.times.nanos": StatsHistogramData;
|
|
359
|
+
"rocksdb.decompression.times.nanos": StatsHistogramData;
|
|
360
|
+
"rocksdb.read.num.merge_operands": StatsHistogramData;
|
|
361
|
+
"rocksdb.blobdb.key.size": StatsHistogramData;
|
|
362
|
+
"rocksdb.blobdb.write.micros": StatsHistogramData;
|
|
363
|
+
"rocksdb.blobdb.get.micros": StatsHistogramData;
|
|
364
|
+
"rocksdb.blobdb.multiget.micros": StatsHistogramData;
|
|
365
|
+
"rocksdb.blobdb.seek.micros": StatsHistogramData;
|
|
366
|
+
"rocksdb.blobdb.next.micros": StatsHistogramData;
|
|
367
|
+
"rocksdb.blobdb.prev.micros": StatsHistogramData;
|
|
368
|
+
"rocksdb.blobdb.blob.file.write.micros": StatsHistogramData;
|
|
369
|
+
"rocksdb.blobdb.blob.file.read.micros": StatsHistogramData;
|
|
370
|
+
"rocksdb.blobdb.blob.file.sync.micros": StatsHistogramData;
|
|
371
|
+
"rocksdb.blobdb.compression.micros": StatsHistogramData;
|
|
372
|
+
"rocksdb.blobdb.decompression.micros": StatsHistogramData;
|
|
373
|
+
"rocksdb.sst.batch.size": StatsHistogramData;
|
|
374
|
+
"rocksdb.multiget.io.batch.size": StatsHistogramData;
|
|
375
|
+
"rocksdb.num.index.and.filter.blocks.read.per.level": StatsHistogramData;
|
|
376
|
+
"rocksdb.num.sst.read.per.level": StatsHistogramData;
|
|
377
|
+
"rocksdb.num.level.read.per.multiget": StatsHistogramData;
|
|
378
|
+
"rocksdb.error.handler.autoresume.retry.count": StatsHistogramData;
|
|
379
|
+
"rocksdb.async.read.bytes": StatsHistogramData;
|
|
380
|
+
"rocksdb.poll.wait.micros": StatsHistogramData;
|
|
381
|
+
"rocksdb.compaction.prefetch.bytes": StatsHistogramData;
|
|
382
|
+
"rocksdb.prefetched.bytes.discarded": StatsHistogramData;
|
|
383
|
+
"rocksdb.async.prefetch.abort.micros": StatsHistogramData;
|
|
384
|
+
"rocksdb.table.open.prefetch.tail.read.bytes": StatsHistogramData;
|
|
385
|
+
"rocksdb.num.op.per.transaction": StatsHistogramData;
|
|
386
|
+
"rocksdb.multiscan.op.prepare.iterators.micros": StatsHistogramData;
|
|
387
|
+
"rocksdb.multiscan.prepare.micros": StatsHistogramData;
|
|
388
|
+
"rocksdb.multiscan.blocks.per.prepare": StatsHistogramData;
|
|
389
|
+
"rocksdb.block.key.distribution.cv": StatsHistogramData;
|
|
390
|
+
};
|
|
391
|
+
type StatsCurated = StatsBasics & StatsCuratedExtras;
|
|
392
|
+
type StatsAll = StatsCurated & StatsAllExtras;
|
|
393
|
+
type StatsValue = number | StatsHistogramData;
|
|
394
|
+
/** Returned by `getStats()` when `all` is omitted or `false`. Curated keys require `enableStats: true`. */
|
|
395
|
+
type StatsDefault = StatsBasics | StatsCurated;
|
|
396
|
+
interface GetStatsMethod {
|
|
397
|
+
getStats(all?: false): StatsDefault;
|
|
398
|
+
getStats(all: true): StatsAll;
|
|
399
|
+
}
|
|
400
|
+
//#endregion
|
|
33
401
|
//#region src/dbi-iterator.d.ts
|
|
34
402
|
interface DBIteratorValue<T> {
|
|
35
403
|
key: Key;
|
|
@@ -469,10 +837,71 @@ type TransactionEntry = {
|
|
|
469
837
|
data: Buffer;
|
|
470
838
|
endTxn: boolean;
|
|
471
839
|
};
|
|
840
|
+
/**
|
|
841
|
+
* A position within a transaction log, identifying a log file by its sequence
|
|
842
|
+
* number and a byte `offset` within that file.
|
|
843
|
+
*/
|
|
844
|
+
type TransactionLogPosition = {
|
|
845
|
+
sequence: number;
|
|
846
|
+
offset: number;
|
|
847
|
+
};
|
|
848
|
+
/**
|
|
849
|
+
* A detailed statistics snapshot for a single transaction log store, returned
|
|
850
|
+
* by {@link TransactionLog.getStats}. All sizes are in bytes; timestamps are
|
|
851
|
+
* milliseconds since the Unix epoch.
|
|
852
|
+
*
|
|
853
|
+
* Memory note: `memory.mappedBytes` is virtual address space — the active write
|
|
854
|
+
* file is mapped at the full configured `maxFileSize` on POSIX, so it does not
|
|
855
|
+
* reflect resident memory. `memory.overlayBytes` (POSIX only; 0 on Windows) is
|
|
856
|
+
* the file-backed portion and is the closer proxy for real consumption.
|
|
857
|
+
*/
|
|
858
|
+
type TransactionLogStats = {
|
|
859
|
+
name: string;
|
|
860
|
+
path: string;
|
|
861
|
+
fileCount: number;
|
|
862
|
+
currentSequenceNumber: number;
|
|
863
|
+
oldestSequenceNumber: number;
|
|
864
|
+
totalSizeBytes: number;
|
|
865
|
+
currentFileSize: number;
|
|
866
|
+
pendingTransactions: number;
|
|
867
|
+
uncommittedTransactions: number;
|
|
868
|
+
replayGapBytes: number;
|
|
869
|
+
memory: {
|
|
870
|
+
mappedBytes: number;
|
|
871
|
+
overlayBytes: number;
|
|
872
|
+
activeMaps: number;
|
|
873
|
+
};
|
|
874
|
+
nextLogPosition: TransactionLogPosition;
|
|
875
|
+
lastFlushedPosition: TransactionLogPosition;
|
|
876
|
+
lastCommittedPosition: TransactionLogPosition | null;
|
|
877
|
+
purge: {
|
|
878
|
+
oldestFileAgeMs: number;
|
|
879
|
+
purgeableFiles: number;
|
|
880
|
+
retainedUnflushedFiles: number;
|
|
881
|
+
lastPurgeMs: number;
|
|
882
|
+
};
|
|
883
|
+
totals: {
|
|
884
|
+
transactionsWritten: number;
|
|
885
|
+
entriesWritten: number;
|
|
886
|
+
bytesWritten: number;
|
|
887
|
+
rotations: number;
|
|
888
|
+
filesPurged: number;
|
|
889
|
+
bytesPurged: number;
|
|
890
|
+
purgeRuns: number;
|
|
891
|
+
databaseFlushes: number;
|
|
892
|
+
writeFailures: number;
|
|
893
|
+
};
|
|
894
|
+
config: {
|
|
895
|
+
maxFileSize: number;
|
|
896
|
+
retentionMs: number;
|
|
897
|
+
maxAgeThreshold: number;
|
|
898
|
+
};
|
|
899
|
+
};
|
|
472
900
|
type TransactionLog = {
|
|
473
901
|
new (db: NativeDatabase, name: string): TransactionLog;
|
|
474
902
|
addEntry(data: Buffer | Uint8Array, txnId?: number): void;
|
|
475
903
|
getLogFileSize(sequenceId?: number): number;
|
|
904
|
+
getStats(): TransactionLogStats;
|
|
476
905
|
name: string;
|
|
477
906
|
path: string;
|
|
478
907
|
query(options?: TransactionLogQueryOptions): IterableIterator<TransactionEntry>;
|
|
@@ -541,17 +970,6 @@ type PurgeLogsOptions = {
|
|
|
541
970
|
destroy?: boolean;
|
|
542
971
|
name?: string;
|
|
543
972
|
};
|
|
544
|
-
type StatsHistogramData = {
|
|
545
|
-
average: number;
|
|
546
|
-
count: number;
|
|
547
|
-
max: number;
|
|
548
|
-
median: number;
|
|
549
|
-
min: number;
|
|
550
|
-
percentile95: number;
|
|
551
|
-
percentile99: number;
|
|
552
|
-
standardDeviation: number;
|
|
553
|
-
sum: number;
|
|
554
|
-
};
|
|
555
973
|
type NativeDatabase = {
|
|
556
974
|
new (): NativeDatabase;
|
|
557
975
|
addListener(event: string, callback: (...args: any[]) => void): void;
|
|
@@ -574,7 +992,8 @@ type NativeDatabase = {
|
|
|
574
992
|
getMonotonicTimestamp(): number;
|
|
575
993
|
getOldestSnapshotTimestamp(): number;
|
|
576
994
|
getStat(statName: string): number | StatsHistogramData;
|
|
577
|
-
getStats(all?:
|
|
995
|
+
getStats(all?: false): StatsDefault;
|
|
996
|
+
getStats(all: true): StatsAll;
|
|
578
997
|
getSync(keyLengthOrKeyBuffer: number | Buffer, flags: number, txnId?: number): Buffer;
|
|
579
998
|
getUserSharedBuffer(key: BufferWithDataView, defaultBuffer: ArrayBuffer, callback?: UserSharedBufferCallback): ArrayBuffer;
|
|
580
999
|
hasLock(key: BufferWithDataView): boolean;
|
|
@@ -666,8 +1085,6 @@ declare const registryStatus: () => RegistryStatus;
|
|
|
666
1085
|
declare const shutdown: () => void;
|
|
667
1086
|
declare const currentThreadId: () => number;
|
|
668
1087
|
declare const stats: {
|
|
669
|
-
histograms: string[];
|
|
670
|
-
tickers: string[];
|
|
671
1088
|
StatsLevel: {
|
|
672
1089
|
DisableAll: number;
|
|
673
1090
|
ExceptTickers: number;
|
|
@@ -1061,8 +1478,8 @@ interface TransactionOptions extends NativeTransactionOptions {
|
|
|
1061
1478
|
*/
|
|
1062
1479
|
retryOnBusy?: boolean;
|
|
1063
1480
|
}
|
|
1064
|
-
type RocksDBStat =
|
|
1065
|
-
type RocksDBStats =
|
|
1481
|
+
type RocksDBStat = StatsValue;
|
|
1482
|
+
type RocksDBStats = StatsDefault | StatsAll;
|
|
1066
1483
|
/**
|
|
1067
1484
|
* The main class for interacting with a RocksDB database.
|
|
1068
1485
|
*
|
|
@@ -1265,15 +1682,22 @@ declare class RocksDatabase extends DBI<DBITransactional> {
|
|
|
1265
1682
|
*/
|
|
1266
1683
|
getStat(statName: string): RocksDBStat;
|
|
1267
1684
|
/**
|
|
1268
|
-
* Gets the RocksDB statistics.
|
|
1685
|
+
* Gets the RocksDB statistics. The RocksDB ticker/histogram stats require
|
|
1686
|
+
* statistics to be enabled, but the result always includes a summarized,
|
|
1687
|
+
* aggregate set of `txnlog.*` keys (across all of this database's transaction
|
|
1688
|
+
* logs), regardless of whether statistics are enabled. For detailed per-log
|
|
1689
|
+
* statistics, including memory-map usage, use `log.getStats()` on the log
|
|
1690
|
+
* returned by {@link RocksDatabase#useLog}.
|
|
1269
1691
|
*
|
|
1270
1692
|
* @example
|
|
1271
1693
|
* ```typescript
|
|
1272
1694
|
* const db = RocksDatabase.open('/path/to/database');
|
|
1273
1695
|
* const stats = db.getStats();
|
|
1696
|
+
* stats['txnlog.totalSizeBytes']; // bytes across all transaction logs
|
|
1274
1697
|
* ```
|
|
1275
1698
|
*/
|
|
1276
|
-
getStats(all?:
|
|
1699
|
+
getStats(all?: false): StatsDefault;
|
|
1700
|
+
getStats(all: true): StatsAll;
|
|
1277
1701
|
/**
|
|
1278
1702
|
* Gets or creates a buffer that can be shared across worker threads.
|
|
1279
1703
|
*
|
|
@@ -1486,5 +1910,5 @@ declare const versions: {
|
|
|
1486
1910
|
"rocksdb-js": string;
|
|
1487
1911
|
};
|
|
1488
1912
|
//#endregion
|
|
1489
|
-
export { DBI, DBIterator, type IteratorOptions, type Key, type RocksDBStat, type RocksDBStats, RocksDatabase, type RocksDatabaseOptions, type StatsHistogramData, Store, type StoreContext, type StoreGetOptions, type StoreIteratorOptions, type StorePutOptions, type StoreRangeOptions, type StoreRemoveOptions, Transaction, type TransactionEntry, TransactionLog, constants, currentThreadId, parseTransactionLog, registryStatus, shutdown, stats, versions };
|
|
1913
|
+
export { DBI, DBIterator, type GetStatsMethod, type IteratorOptions, type Key, 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, constants, currentThreadId, parseTransactionLog, registryStatus, shutdown, stats, versions };
|
|
1490
1914
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.mjs
CHANGED
|
@@ -574,8 +574,6 @@ const VALUE_BUFFER = createFixedBuffer(64 * 1024);
|
|
|
574
574
|
const ITERATOR_STATE_BUFFER = Buffer.allocUnsafeSlow(8);
|
|
575
575
|
const ITERATOR_STATE = new Uint32Array(ITERATOR_STATE_BUFFER.buffer, ITERATOR_STATE_BUFFER.byteOffset, 2);
|
|
576
576
|
const MAX_KEY_SIZE = 1024 * 1024;
|
|
577
|
-
const RESET_BUFFER_MODE = 1024;
|
|
578
|
-
const REUSE_BUFFER_MODE = 512;
|
|
579
577
|
const SAVE_BUFFER_SIZE = 8192;
|
|
580
578
|
/**
|
|
581
579
|
* A store wraps the `NativeDatabase` binding and database settings so that a
|
|
@@ -865,7 +863,7 @@ var Store = class {
|
|
|
865
863
|
encodeValue(value) {
|
|
866
864
|
if (value && value["binary-data"]) return value["binary-data"];
|
|
867
865
|
if (typeof this.encoder?.encode === "function") {
|
|
868
|
-
if (this.encoder.copyBuffers) return this.encoder.encode(value,
|
|
866
|
+
if (this.encoder.copyBuffers) return this.encoder.encode(value, 1536);
|
|
869
867
|
const valueBuffer = this.encoder.encode(value);
|
|
870
868
|
if (typeof valueBuffer === "string") return Buffer.from(valueBuffer);
|
|
871
869
|
return valueBuffer;
|
|
@@ -1521,17 +1519,8 @@ var RocksDatabase = class RocksDatabase extends DBI {
|
|
|
1521
1519
|
getStat(statName) {
|
|
1522
1520
|
return this.store.db.getStat(statName);
|
|
1523
1521
|
}
|
|
1524
|
-
/**
|
|
1525
|
-
* Gets the RocksDB statistics. Requires statistics to be enabled.
|
|
1526
|
-
*
|
|
1527
|
-
* @example
|
|
1528
|
-
* ```typescript
|
|
1529
|
-
* const db = RocksDatabase.open('/path/to/database');
|
|
1530
|
-
* const stats = db.getStats();
|
|
1531
|
-
* ```
|
|
1532
|
-
*/
|
|
1533
1522
|
getStats(all = false) {
|
|
1534
|
-
return this.store.db.getStats(
|
|
1523
|
+
return all ? this.store.db.getStats(true) : this.store.db.getStats(false);
|
|
1535
1524
|
}
|
|
1536
1525
|
/**
|
|
1537
1526
|
* Gets or creates a buffer that can be shared across worker threads.
|
|
@@ -1894,7 +1883,6 @@ var RocksDatabase = class RocksDatabase extends DBI {
|
|
|
1894
1883
|
//#region src/parse-transaction-log.ts
|
|
1895
1884
|
const { TRANSACTION_LOG_TOKEN, TRANSACTION_LOG_ENTRY_HEADER_SIZE: TRANSACTION_LOG_ENTRY_HEADER_SIZE$1 } = constants;
|
|
1896
1885
|
const MIN_VALID_TIMESTAMP = Date.UTC(2026, 0, 27);
|
|
1897
|
-
const VALID_FLAGS_MASK = 1;
|
|
1898
1886
|
/**
|
|
1899
1887
|
* Loads an entire transaction log file into memory.
|
|
1900
1888
|
* @param path - The path to the transaction log file.
|
|
@@ -1948,7 +1936,7 @@ function parseTransactionLog(path, options = {}) {
|
|
|
1948
1936
|
const data = read(length);
|
|
1949
1937
|
const entryAnomalies = [];
|
|
1950
1938
|
if (!Number.isFinite(timestamp) || timestamp < MIN_VALID_TIMESTAMP) entryAnomalies.push(`timestamp ${timestamp} predates 2026-01-27 (possible corruption)`);
|
|
1951
|
-
if ((flags &
|
|
1939
|
+
if ((flags & -2) !== 0) entryAnomalies.push(`flags 0x${flags.toString(16).padStart(2, "0")} contains undefined bits (expected 0x00 or 0x01)`);
|
|
1952
1940
|
const entry = {
|
|
1953
1941
|
timestamp,
|
|
1954
1942
|
length,
|
|
@@ -2165,7 +2153,7 @@ function loadLastPosition(transactionLog, readUncommitted) {
|
|
|
2165
2153
|
//#region src/index.ts
|
|
2166
2154
|
const versions = {
|
|
2167
2155
|
rocksdb: version,
|
|
2168
|
-
"rocksdb-js": "1.
|
|
2156
|
+
"rocksdb-js": "2.1.0"
|
|
2169
2157
|
};
|
|
2170
2158
|
|
|
2171
2159
|
//#endregion
|