Comparing version 2.2.4 to 2.2.5
@@ -133,3 +133,3 @@ declare namespace lmdb { | ||
**/ | ||
getKeys(options: RangeOptions): ArrayLikeIterable<K> | ||
getKeys(options?: RangeOptions): ArrayLikeIterable<K> | ||
/** | ||
@@ -140,3 +140,3 @@ * Get the count of all the unique keys for the given range | ||
**/ | ||
getKeysCount(options: RangeOptions): number | ||
getKeysCount(options?: RangeOptions): number | ||
/** | ||
@@ -147,3 +147,3 @@ * Get all the entries for the given range | ||
**/ | ||
getRange(options: RangeOptions): ArrayLikeIterable<{ key: K, value: V, version?: number }> | ||
getRange(options?: RangeOptions): ArrayLikeIterable<{ key: K, value: V, version?: number }> | ||
/** | ||
@@ -154,3 +154,3 @@ * Get the count of all the entries for the given range | ||
**/ | ||
getCount(options: RangeOptions): number | ||
getCount(options?: RangeOptions): number | ||
/** | ||
@@ -157,0 +157,0 @@ * @deprecated since version 2.0, use transaction() instead |
@@ -157,3 +157,3 @@ import { Compression, getAddress, require, arch, fs, path as pathModule, lmdbError, EventEmitter, MsgpackrEncoder, Env, tmpdir, os, isWorkerThread } from './external.js'; | ||
this.db = env.openDbi(flags, dbName, keyType, dbOptions.compression); | ||
}); | ||
}, options.overlappingSync ? 0x10002 : 2); // no flush-sync, but synchronously commit | ||
} else { | ||
@@ -160,0 +160,0 @@ return; // return undefined to indicate it could not be found |
{ | ||
"name": "lmdb", | ||
"author": "Kris Zyp", | ||
"version": "2.2.4", | ||
"version": "2.2.5", | ||
"description": "Simple, efficient, scalable, high-performance LMDB interface", | ||
@@ -6,0 +6,0 @@ "license": "MIT", |
43
write.js
@@ -156,3 +156,3 @@ import { getAddress, onExit } from './external.js'; | ||
endPosition = store.writeKey(key, targetBytes, keyStartPosition); | ||
if (!(keyStartPosition < endPosition) && flags != 12) | ||
if (!(keyStartPosition < endPosition) && (flags & 0xf) != 12) | ||
throw new Error('Invalid key or zero length key is not allowed in LMDB') | ||
@@ -364,21 +364,4 @@ } catch(error) { | ||
case 0: | ||
if (resolvers.length > 0) { | ||
if (committedFlushResolvers) | ||
committedFlushResolvers.push(...resolvers) | ||
else { | ||
committedFlushResolvers = resolvers | ||
let delay = Math.min(Date.now() - start, maxFlushDelay) | ||
setTimeout(() => lastSync.then(() => { | ||
let resolvers = committedFlushResolvers | ||
committedFlushResolvers = null | ||
lastSync = new Promise((resolve) => { | ||
env.sync(() => { | ||
for (let i = 0; i < resolvers.length; i++) | ||
resolvers[i](); | ||
resolve(); | ||
}); | ||
}); | ||
}), delay); | ||
} | ||
} | ||
if (resolvers.length > 0) | ||
scheduleFlush(resolvers, Math.min(Date.now() - start, maxFlushDelay)) | ||
case 1: | ||
@@ -399,2 +382,20 @@ break; | ||
} | ||
function scheduleFlush(resolvers, delay) { | ||
if (committedFlushResolvers) | ||
committedFlushResolvers.push(...resolvers) | ||
else { | ||
committedFlushResolvers = resolvers | ||
setTimeout(() => lastSync.then(() => { | ||
let resolvers = committedFlushResolvers || [] | ||
committedFlushResolvers = null | ||
lastSync = new Promise((resolve) => { | ||
env.sync(() => { | ||
for (let i = 0; i < resolvers.length; i++) | ||
resolvers[i](); | ||
resolve(); | ||
}); | ||
}); | ||
}), delay || 0); | ||
} | ||
} | ||
@@ -770,2 +771,4 @@ function queueCommitResolution(resolution) { | ||
resetReadTxn(); | ||
if ((flags & 0x10000) && overlappingSync) // if it is no-sync in overlapping-sync mode, need to schedule flush for it to be marked as persisted | ||
scheduleFlush([]) | ||
} | ||
@@ -772,0 +775,0 @@ return result; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5138
17737844
160