@nxtedition/rocksdb 7.0.50 → 7.0.53
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/index.js
CHANGED
|
@@ -16,6 +16,7 @@ const kContext = Symbol('context')
|
|
|
16
16
|
const kColumns = Symbol('columns')
|
|
17
17
|
const kLocation = Symbol('location')
|
|
18
18
|
const kPromise = Symbol('promise')
|
|
19
|
+
const kUpdates = Symbol('updates')
|
|
19
20
|
|
|
20
21
|
const EMPTY = {}
|
|
21
22
|
|
|
@@ -64,6 +65,9 @@ class RocksLevel extends AbstractLevel {
|
|
|
64
65
|
this[kLocation] = location
|
|
65
66
|
this[kContext] = binding.db_init()
|
|
66
67
|
this[kColumns] = {}
|
|
68
|
+
|
|
69
|
+
// .updates(...) uses 'write' listener.
|
|
70
|
+
this.setMaxListeners(100)
|
|
67
71
|
}
|
|
68
72
|
|
|
69
73
|
get sequence () {
|
|
@@ -339,6 +343,7 @@ class RocksLevel extends AbstractLevel {
|
|
|
339
343
|
}
|
|
340
344
|
|
|
341
345
|
options.signal?.addEventListener('abort', onAbort)
|
|
346
|
+
this.on('closing', onAbort)
|
|
342
347
|
|
|
343
348
|
try {
|
|
344
349
|
let since = options.since
|
|
@@ -376,7 +381,7 @@ class RocksLevel extends AbstractLevel {
|
|
|
376
381
|
|
|
377
382
|
try {
|
|
378
383
|
if (since <= this.sequence) {
|
|
379
|
-
for await (const update of this
|
|
384
|
+
for await (const update of this[kUpdates](options)) {
|
|
380
385
|
if (ac.signal.aborted) {
|
|
381
386
|
throw new AbortError()
|
|
382
387
|
}
|
|
@@ -403,11 +408,12 @@ class RocksLevel extends AbstractLevel {
|
|
|
403
408
|
}
|
|
404
409
|
}
|
|
405
410
|
} finally {
|
|
406
|
-
|
|
411
|
+
this.off('closing', onAbort)
|
|
412
|
+
options.signal?.removeEventListener('abort', onAbort)
|
|
407
413
|
}
|
|
408
414
|
}
|
|
409
415
|
|
|
410
|
-
async *
|
|
416
|
+
async * [kUpdates] (options) {
|
|
411
417
|
class Updates {
|
|
412
418
|
constructor (db, options) {
|
|
413
419
|
this.context = binding.updates_init(db[kContext], options)
|
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|