lmdb
Advanced tools
Comparing version 2.8.5 to 2.9.0-alpha.1
@@ -28,2 +28,4 @@ import { EventEmitter } from 'events'; | ||
export let { noop } = nativeAddon; | ||
export const TIMESTAMP_PLACEHOLDER = new Uint8Array([1,1,1,1,0,0,0,0]); | ||
export const DIRECT_WRITE_PLACEHOLDER = new Uint8Array([1,1,1,2,0,0,0,0]); | ||
export { open, openAsClass, getLastVersion, allDbs, getLastTxnId } from './open.js'; | ||
@@ -35,2 +37,3 @@ import { toBufferKey as keyValueToBuffer, compareKeys as compareKey, fromBufferKey as bufferToKeyValue } from 'ordered-binary'; | ||
SYNCHRONOUS_COMMIT: 2, | ||
NO_SYNC_FLUSH: 0x10000, | ||
@@ -37,0 +40,0 @@ }; |
import { dirname, join, default as pathModule } from 'path'; | ||
import { fileURLToPath } from 'url'; | ||
import loadNAPI from 'node-gyp-build-optional-packages'; | ||
export let Env, Txn, Dbi, Compression, Cursor, getAddress, getBufferAddress, createBufferForAddress, clearKeptObjects, globalBuffer, setGlobalBuffer, arch, fs, os, onExit, tmpdir, lmdbError, path, EventEmitter, orderedBinary, MsgpackrEncoder, WeakLRUCache, setEnvMap, getEnvMap, getByBinary, detachBuffer, startRead, setReadCallback, write, position, iterate, prefetch, resetTxn, getCurrentValue, getCurrentShared, getStringByBinary, getSharedByBinary, getSharedBuffer, compress; | ||
export let Env, Txn, Dbi, Compression, Cursor, getAddress, getBufferAddress, createBufferForAddress, clearKeptObjects, globalBuffer, setGlobalBuffer, arch, fs, os, onExit, tmpdir, lmdbError, path, EventEmitter, orderedBinary, MsgpackrEncoder, WeakLRUCache, setEnvMap, getEnvMap, getByBinary, detachBuffer, startRead, setReadCallback, write, position, iterate, prefetch, resetTxn, getCurrentValue, getCurrentShared, getStringByBinary, getSharedByBinary, getSharedBuffer, compress, directWrite, attemptLock, unlock; | ||
path = pathModule; | ||
@@ -64,2 +64,5 @@ let dirName = dirname(fileURLToPath(import.meta.url)).replace(/dist$/, ''); | ||
resetTxn = externals.resetTxn; | ||
directWrite = externals.directWrite; | ||
attemptLock = externals.attemptLock; | ||
unlock = externals.unlock; | ||
getCurrentValue = externals.getCurrentValue; | ||
@@ -66,0 +69,0 @@ getCurrentShared = externals.getCurrentShared; |
{ | ||
"name": "lmdb", | ||
"author": "Kris Zyp", | ||
"version": "2.8.5", | ||
"version": "2.9.0-alpha.1", | ||
"description": "Simple, efficient, scalable, high-performance LMDB interface", | ||
@@ -65,9 +65,9 @@ "license": "MIT", | ||
"before-publish": "rollup -c && prebuildify-ci download && node util/set-optional-deps.cjs && npm run test", | ||
"prebuild-libc-musl": "ENABLE_V8_FUNCTIONS=false prebuildify-platform-packages --tag-libc --napi --platform-packages --target 16.18.0", | ||
"prebuild-libc": "prebuildify-platform-packages --tag-libc --target 20.0.0 || true && prebuildify-platform-packages --tag-libc --target 18.15.0 && prebuildify-platform-packages --platform-packages --tag-libc --target 16.18.0 && ENABLE_V8_FUNCTIONS=false prebuildify-platform-packages --napi --platform-packages --tag-libc --target 16.18.0", | ||
"prebuild-macos": "prebuildify-platform-packages --target 20.0.0 && prebuildify-platform-packages --target 18.15.0 && prebuildify-platform-packages --platform-packages --target 16.18.0 && ENABLE_V8_FUNCTIONS=false prebuildify-platform-packages --napi --platform-packages --target 16.18.0", | ||
"prebuild-win32": "prebuildify-platform-packages --target 20.0.0 && prebuildify-platform-packages --target 18.15.0 && prebuildify-platform-packages --target 16.18.0 && set ENABLE_V8_FUNCTIONS=false&& prebuildify-platform-packages --napi --platform-packages --target 16.18.0", | ||
"prebuild-libc-arm7": "ENABLE_V8_FUNCTIONS=false prebuildify-platform-packages --napi --platform-packages --tag-libc --target 16.18.0", | ||
"prebuildify": "prebuildify-platform-packages --napi --target 18.15.0", | ||
"full-publish": "cd prebuilds/win32-x64 && npm publish --access public && cd ../darwin-x64 && npm publish --access public && cd ../darwin-arm64 && npm publish --access public && cd ../linux-x64 && npm publish --access public && cd ../linux-arm64 && npm publish --access public && cd ../linux-arm && npm publish --access public && cd ../.. && npm publish", | ||
"prebuild-libc-musl": "ENABLE_V8_FUNCTIONS=false prebuildify-platform-packages --tag-libc --napi --platform-packages --target 18.17.1", | ||
"prebuild-libc": "prebuildify-platform-packages --tag-libc --target 20.0.0 || true && prebuildify-platform-packages --platform-packages --tag-libc --target 18.17.1 && ENABLE_V8_FUNCTIONS=false prebuildify-platform-packages --napi --platform-packages --tag-libc --target 18.17.1", | ||
"prebuild-macos": "prebuildify-platform-packages --target 20.0.0 && prebuildify-platform-packages --platform-packages --target 18.17.1 && ENABLE_V8_FUNCTIONS=false prebuildify-platform-packages --napi --platform-packages --target 18.17.1", | ||
"prebuild-win32": "prebuildify-platform-packages --target 20.0.0 && prebuildify-platform-packages --target 18.17.1 && set ENABLE_V8_FUNCTIONS=false&& prebuildify-platform-packages --napi --platform-packages --target 18.17.1", | ||
"prebuild-libc-arm7": "ENABLE_V8_FUNCTIONS=false prebuildify-platform-packages --napi --platform-packages --tag-libc --target 18.17.1", | ||
"prebuildify": "prebuildify-platform-packages --napi --target 18.17.1", | ||
"full-publish": "cd prebuilds/win32-x64 && npm publish --tag dev --access public && cd ../darwin-x64 && npm publish --tag dev --access public && cd ../darwin-arm64 && npm publish --tag dev --access public && cd ../linux-x64 && npm publish --tag dev --access public && cd ../linux-arm64 && npm publish --tag dev --access public && cd ../linux-arm && npm publish --tag dev --access public && cd ../.. && npm publish --tag dev", | ||
"recompile": "node-gyp clean && node-gyp configure && node-gyp build", | ||
@@ -82,3 +82,3 @@ "test": "mocha test/**.test.js --expose-gc --recursive", | ||
"dependencies": { | ||
"msgpackr": "^1.9.5", | ||
"msgpackr": "^1.9.9", | ||
"node-addon-api": "^6.1.0", | ||
@@ -98,3 +98,2 @@ "node-gyp-build-optional-packages": "5.1.1", | ||
"prebuildify-platform-packages": "5.0.4", | ||
"prettier": "^3.0.2", | ||
"rimraf": "^3.0.2", | ||
@@ -111,14 +110,10 @@ "rollup": "^2.61.1", | ||
}, | ||
"prettier": { | ||
"useTabs": true, | ||
"singleQuote": true | ||
}, | ||
"optionalDependencies": { | ||
"@lmdb/lmdb-darwin-arm64": "2.8.5", | ||
"@lmdb/lmdb-darwin-x64": "2.8.5", | ||
"@lmdb/lmdb-linux-arm": "2.8.5", | ||
"@lmdb/lmdb-linux-arm64": "2.8.5", | ||
"@lmdb/lmdb-linux-x64": "2.8.5", | ||
"@lmdb/lmdb-win32-x64": "2.8.5" | ||
"@lmdb/lmdb-darwin-arm64": "2.9.0-alpha.1", | ||
"@lmdb/lmdb-darwin-x64": "2.9.0-alpha.1", | ||
"@lmdb/lmdb-linux-arm": "2.9.0-alpha.1", | ||
"@lmdb/lmdb-linux-arm64": "2.9.0-alpha.1", | ||
"@lmdb/lmdb-linux-x64": "2.9.0-alpha.1", | ||
"@lmdb/lmdb-win32-x64": "2.9.0-alpha.1" | ||
} | ||
} |
52
read.js
import { RangeIterable } from './util/RangeIterable.js'; | ||
import { getAddress, Cursor, Txn, orderedBinary, lmdbError, getByBinary, setGlobalBuffer, prefetch, iterate, position as doPosition, resetTxn, getCurrentValue, getCurrentShared, getStringByBinary, globalBuffer, getSharedBuffer, startRead, setReadCallback } from './native.js'; | ||
import { | ||
getAddress, | ||
Cursor, | ||
Txn, | ||
orderedBinary, | ||
lmdbError, | ||
getByBinary, | ||
setGlobalBuffer, | ||
prefetch, | ||
iterate, | ||
position as doPosition, | ||
resetTxn, | ||
getCurrentValue, | ||
getCurrentShared, | ||
getStringByBinary, | ||
globalBuffer, | ||
getSharedBuffer, | ||
startRead, | ||
setReadCallback, | ||
directWrite, | ||
attemptLock, | ||
unlock | ||
} from './native.js'; | ||
import { saveKey } from './keys.js'; | ||
@@ -262,2 +284,30 @@ const IF_EXISTS = 3.542694326329068e-103; | ||
}, | ||
directWrite(id, options) { | ||
let rc; | ||
let txn = env.writeTxn || (options && options.transaction) || (readTxnRenewed ? readTxn : renewReadTxn(this)); | ||
let keySize = this.writeKey(id, keyBytes, 0); | ||
let dataOffset = (((keySize >> 3) + 1) << 3); | ||
keyBytes.set(options.bytes, dataOffset) | ||
rc = directWrite(this.dbAddress, keySize, options.offset, options.bytes.length, txn.address || 0); | ||
if (rc < 0) lmdbError(rc); | ||
}, | ||
attemptLock(id, version, callback) { | ||
keyBytes.dataView.setUint32(0, this.db.dbi); | ||
keyBytes.dataView.setFloat64(4, version); | ||
let keySize = this.writeKey(id, keyBytes, 12); | ||
return attemptLock(env.address, keySize, callback); | ||
}, | ||
unlock(id, version, onlyCheck) { | ||
keyBytes.dataView.setUint32(0, this.db.dbi); | ||
keyBytes.dataView.setFloat64(4, version); | ||
let keySize = this.writeKey(id, keyBytes, 12); | ||
return unlock(env.address, keySize, onlyCheck); | ||
}, | ||
hasLock(id, version) { | ||
return this.unlock(id, version, true); | ||
}, | ||
resetReadTxn() { | ||
@@ -264,0 +314,0 @@ resetReadTxn(); |
@@ -340,3 +340,4 @@ import { getAddress, getBufferAddress, write, compress, lmdbError } from './native.js'; | ||
} | ||
if (ifVersion === undefined) { | ||
// if it is not conditional because of ifVersion or has any flags that can make the write conditional | ||
if (ifVersion === undefined && !(flags & 0x22030)) { | ||
if (writtenBatchDepth > 1) { | ||
@@ -601,2 +602,4 @@ if (!resolution.flag && !store.cache) | ||
flags |= 0x20; | ||
if (versionOrOptions.instructedWrite) | ||
flags |= 0x2000; | ||
if (versionOrOptions.append) | ||
@@ -603,0 +606,0 @@ flags |= 0x20000; |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
2425168
11
6338
1
+ Added@lmdb/lmdb-darwin-arm64@2.9.0-alpha.1(transitive)
+ Added@lmdb/lmdb-darwin-x64@2.9.0-alpha.1(transitive)
+ Added@lmdb/lmdb-linux-arm@2.9.0-alpha.1(transitive)
+ Added@lmdb/lmdb-linux-arm64@2.9.0-alpha.1(transitive)
+ Added@lmdb/lmdb-linux-x64@2.9.0-alpha.1(transitive)
+ Added@lmdb/lmdb-win32-x64@2.9.0-alpha.1(transitive)
- Removed@lmdb/lmdb-darwin-arm64@2.8.5(transitive)
- Removed@lmdb/lmdb-darwin-x64@2.8.5(transitive)
- Removed@lmdb/lmdb-linux-arm@2.8.5(transitive)
- Removed@lmdb/lmdb-linux-arm64@2.8.5(transitive)
- Removed@lmdb/lmdb-linux-x64@2.8.5(transitive)
- Removed@lmdb/lmdb-win32-x64@2.8.5(transitive)
Updatedmsgpackr@^1.9.9