Comparing version 2.6.0-alpha3 to 2.6.0-alpha4
24
keys.js
import { getAddress, orderedBinary } from './native.js'; | ||
const REUSE_BUFFER_MODE = 512; | ||
const writeUint32Key = (key, target, start) => { | ||
@@ -27,5 +28,10 @@ (target.dataView || (target.dataView = new DataView(target.buffer, 0, target.length))).setUint32(start, key, true); | ||
if (store.encoder && store.encoder.writeKey && !store.encoder.encode) { | ||
store.encoder.encode = function(value) { | ||
return saveKey(value, this.writeKey, false, store.maxKeySize); | ||
store.encoder.encode = function(value, mode) { | ||
let bytes = saveKey(value, this.writeKey, false, store.maxKeySize); | ||
if (bytes.end > 0 && !(REUSE_BUFFER_MODE & mode)) { | ||
return bytes.subarray(bytes.start, bytes.end) | ||
} | ||
return bytes; | ||
}; | ||
store.encoder.copyBuffers = true; // just an indicator for the buffer reuse in write.js | ||
} | ||
@@ -69,4 +75,2 @@ if (store.decoder && store.decoder.readKey && !store.decoder.decode) { | ||
} | ||
if (skip > 0) | ||
savePosition += skip; | ||
let start = savePosition; | ||
@@ -107,14 +111,2 @@ try { | ||
} | ||
} | ||
export function saveRead(txn, dbi, key, writeKey, saveTo, maxKeySize) { | ||
let start = savePosition; | ||
saveKey(key, writeKey, saveTo, maxKeySize, 12); | ||
if (start > savePosition) | ||
start = 0; | ||
if (!uint32) | ||
uint32 = new Uint32Array(saveBuffer.buffer, 0, saveBuffer.buffer.byteLength >> 2); | ||
saveDataView.setFloat64(start, txn.address, true); | ||
if (Atomics.or(uint32, (start >> 2) + 2, dbi)) { | ||
return start + saveDataAddress; | ||
} | ||
} |
@@ -114,2 +114,3 @@ import { Compression, getAddress, arch, fs, path as pathModule, lmdbError, EventEmitter, MsgpackrEncoder, Env, Dbi, tmpdir, os, nativeAddon } from './native.js'; | ||
let rc = env.open(options, flags, jsFlags); | ||
env.path = path; | ||
if (rc) | ||
@@ -116,0 +117,0 @@ lmdbError(rc); |
{ | ||
"name": "lmdb", | ||
"author": "Kris Zyp", | ||
"version": "2.6.0-alpha3", | ||
"version": "2.6.0-alpha4", | ||
"description": "Simple, efficient, scalable, high-performance LMDB interface", | ||
@@ -76,3 +76,3 @@ "license": "MIT", | ||
"dependencies": { | ||
"msgpackr": "^1.7.0-alpha1", | ||
"msgpackr": "^1.7.0-alpha2", | ||
"node-addon-api": "^4.3.0", | ||
@@ -103,9 +103,9 @@ "node-gyp-build-optional-packages": "5.0.3", | ||
"optionalDependencies": { | ||
"@lmdb/lmdb-darwin-arm64": "2.6.0-alpha3", | ||
"@lmdb/lmdb-darwin-x64": "2.6.0-alpha3", | ||
"@lmdb/lmdb-linux-arm": "2.6.0-alpha3", | ||
"@lmdb/lmdb-linux-arm64": "2.6.0-alpha3", | ||
"@lmdb/lmdb-linux-x64": "2.6.0-alpha3", | ||
"@lmdb/lmdb-win32-x64": "2.6.0-alpha3" | ||
"@lmdb/lmdb-darwin-arm64": "2.6.0-alpha4", | ||
"@lmdb/lmdb-darwin-x64": "2.6.0-alpha4", | ||
"@lmdb/lmdb-linux-arm": "2.6.0-alpha4", | ||
"@lmdb/lmdb-linux-arm64": "2.6.0-alpha4", | ||
"@lmdb/lmdb-linux-x64": "2.6.0-alpha4", | ||
"@lmdb/lmdb-win32-x64": "2.6.0-alpha4" | ||
} | ||
} |
@@ -603,3 +603,3 @@ import { RangeIterable } from './util/RangeIterable.js'; | ||
} | ||
let txnPromise = this._endWrites(); | ||
let txnPromise = this._endWrites && this._endWrites(); | ||
const doClose = () => { | ||
@@ -606,0 +606,0 @@ if (this.isRoot) |
@@ -801,5 +801,6 @@ import { getAddress, write, compress } from './native.js'; | ||
else { | ||
env.commitTxn(); | ||
let hasWrites = env.commitTxn(); | ||
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 | ||
if ((flags & 0x10000) && overlappingSync && hasWrites) // if it is no-sync in overlapping-sync mode, need | ||
// to schedule flush for it to be marked as persisted | ||
lastSyncTxnFlush = new Promise(resolve => scheduleFlush([resolve])) | ||
@@ -806,0 +807,0 @@ } |
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
2284153
+ Added@lmdb/lmdb-darwin-arm64@2.6.0-alpha4(transitive)
+ Added@lmdb/lmdb-darwin-x64@2.6.0-alpha4(transitive)
+ Added@lmdb/lmdb-linux-arm@2.6.0-alpha4(transitive)
+ Added@lmdb/lmdb-linux-arm64@2.6.0-alpha4(transitive)
+ Added@lmdb/lmdb-linux-x64@2.6.0-alpha4(transitive)
+ Added@lmdb/lmdb-win32-x64@2.6.0-alpha4(transitive)
- Removed@lmdb/lmdb-darwin-arm64@2.6.0-alpha3(transitive)
- Removed@lmdb/lmdb-darwin-x64@2.6.0-alpha3(transitive)
- Removed@lmdb/lmdb-linux-arm@2.6.0-alpha3(transitive)
- Removed@lmdb/lmdb-linux-arm64@2.6.0-alpha3(transitive)
- Removed@lmdb/lmdb-linux-x64@2.6.0-alpha3(transitive)
- Removed@lmdb/lmdb-win32-x64@2.6.0-alpha3(transitive)
Updatedmsgpackr@^1.7.0-alpha2