lmdb
Advanced tools
Comparing version 2.9.3-beta.6-debug to 2.10.0-beta.1
{ | ||
"name": "lmdb", | ||
"author": "Kris Zyp", | ||
"version": "2.9.3-beta.6-debug", | ||
"version": "2.10.0-beta.1", | ||
"description": "Simple, efficient, scalable, high-performance LMDB interface", | ||
@@ -113,9 +113,9 @@ "license": "MIT", | ||
"optionalDependencies": { | ||
"@lmdb/lmdb-darwin-arm64": "2.9.3-beta.5-debug", | ||
"@lmdb/lmdb-darwin-x64": "2.9.3-beta.5-debug", | ||
"@lmdb/lmdb-linux-arm": "2.9.3-beta.5-debug", | ||
"@lmdb/lmdb-linux-arm64": "2.9.3-beta.5-debug", | ||
"@lmdb/lmdb-linux-x64": "2.9.3-beta.5-debug", | ||
"@lmdb/lmdb-win32-x64": "2.9.3-beta.5-debug" | ||
"@lmdb/lmdb-darwin-arm64": "2.10.0-beta.1", | ||
"@lmdb/lmdb-darwin-x64": "2.10.0-beta.1", | ||
"@lmdb/lmdb-linux-arm": "2.10.0-beta.1", | ||
"@lmdb/lmdb-linux-arm64": "2.10.0-beta.1", | ||
"@lmdb/lmdb-linux-x64": "2.10.0-beta.1", | ||
"@lmdb/lmdb-win32-x64": "2.10.0-beta.1" | ||
} | ||
} |
@@ -409,3 +409,2 @@ import { RangeIterable } from './util/RangeIterable.js'; | ||
let store = this; | ||
let txn_handle; | ||
function resetCursor() { | ||
@@ -440,2 +439,3 @@ try { | ||
if (txn.use) txn.use(); // track transaction so we always use the same one | ||
else txn.refCount = (txn.refCount || 0) + 1; | ||
if (snapshot === false) { | ||
@@ -501,3 +501,7 @@ cursorRenewId = renewId; // use shared read transaction | ||
txn.renewingRefCount--; | ||
txn.done?.(); | ||
if (txn.done) txn.done(); | ||
else if (--txn.refCount <= 0 && txn.notCurrent) { | ||
txn.abort(); | ||
txn.isDone = true; | ||
} | ||
if (txn.refCount <= 0 && txn.notCurrent) { | ||
@@ -504,0 +508,0 @@ cursor.close(); |
@@ -176,7 +176,15 @@ export const SKIP = {}; | ||
return { | ||
next() { | ||
next(resolvedResult) { | ||
try { | ||
do { | ||
if (currentSubIterator) { | ||
let result = currentSubIterator.next(); | ||
let result; | ||
if (resolvedResult) { | ||
result = resolvedResult; | ||
resolvedResult = undefined; | ||
} else result = currentSubIterator.next(); | ||
if (result.then) { | ||
if (!async) throw new Error('Can not synchronously iterate with asynchronous values'); | ||
return result.then((result) => this.next(result)); | ||
} | ||
if (!result.done) { | ||
@@ -186,3 +194,8 @@ return result; | ||
} | ||
let result = iterator.next(); | ||
let result = resolvedResult ?? iterator.next(); | ||
if (result.then) { | ||
if (!async) throw new Error('Can not synchronously iterate with asynchronous values'); | ||
currentSubIterator = undefined; | ||
return result.then((result) => this.next(result)); | ||
} | ||
if (result.done) { | ||
@@ -193,2 +206,14 @@ if (mappedIterable.onDone) mappedIterable.onDone(); | ||
let value = callback(result.value); | ||
if (value?.then) { | ||
if (!async) throw new Error('Can not synchronously iterate with asynchronous values'); | ||
return value.then((value) => { | ||
if (Array.isArray(value) || value instanceof RangeIterable) { | ||
currentSubIterator = value[Symbol.iterator](); | ||
return this.next(); | ||
} else { | ||
currentSubIterator = null; | ||
return { value }; | ||
} | ||
}) | ||
} | ||
if (Array.isArray(value) || value instanceof RangeIterable) | ||
@@ -195,0 +220,0 @@ currentSubIterator = value[Symbol.iterator](); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
2446998
6542