Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

lmdb

Package Overview
Dependencies
Maintainers
3
Versions
178
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lmdb - npm Package Compare versions

Comparing version 2.6.0-alpha5 to 2.6.0-alpha6

4

caching.js

@@ -51,3 +51,3 @@ import { WeakLRUCache, clearKeptObjects } from './native.js';

let cachedValue = entry.value;
if (entry.txnId) {
if (entry.txnId != null) {
value = super.get(id, { ifNotTxnId: entry.txnId });

@@ -57,3 +57,3 @@ if (value === UNMODIFIED)

} else // with no txn id we do not validate; this is the state of a cached value after a write before it transacts
value = cachedValue;
return cachedValue;
} else

@@ -60,0 +60,0 @@ value = super.get(id);

@@ -0,0 +0,0 @@ /* sample-bdb.txt - BerkeleyDB toy/sample

@@ -0,0 +0,0 @@ /* sample-mdb.txt - MDB toy/sample

@@ -0,0 +0,0 @@ LZ4 Windows binary package

@@ -0,0 +0,0 @@ LZ4 - Library Files

@@ -226,3 +226,3 @@ import { Compression, getAddress, arch, fs, path as pathModule, lmdbError, EventEmitter, MsgpackrEncoder, Env, Dbi, tmpdir, os, nativeAddon } from './native.js';

this.encoder = new Encoder(Object.assign(
assignConstrainedProperties(['copyBuffers', 'getStructures', 'saveStructures', 'useFloat32', 'useRecords', 'structuredClone', 'variableMapSize', 'useTimestamp32', 'largeBigIntToFloat', 'encodeUndefinedAsNil', 'int64AsNumber', 'onInvalidDate', 'mapsAsObjects', 'useTag259ForMaps', 'pack', 'maxSharedStructures', 'shouldShareStructure', 'randomAccessStructure', 'freezeData'],
assignConstrainedProperties(['copyBuffers', 'getStructure', 'getStructures', 'saveStructure', 'saveStructures', 'useFloat32', 'useRecords', 'structuredClone', 'variableMapSize', 'useTimestamp32', 'largeBigIntToFloat', 'encodeUndefinedAsNil', 'int64AsNumber', 'onInvalidDate', 'mapsAsObjects', 'useTag259ForMaps', 'pack', 'maxSharedStructures', 'shouldShareStructure', 'randomAccessStructure', 'freezeData'],
this.sharedStructuresKey ? this.setupSharedStructures() : {

@@ -349,2 +349,23 @@ copyBuffers: true, // need to copy any embedded buffers that are found since we use unsafe buffers

getStructures,
getStructure: (id) => {
let lastVersion; // because we are doing a read here, we may need to save and restore the lastVersion from the last read
if (this.useVersions)
lastVersion = getLastVersion();
let buffer = this.getBinary([this.sharedStructuresKey, id]);
if (this.useVersions)
setLastVersion(lastVersion);
return buffer;
},
saveStructure: (id, structure, isCompatible) => {
return this.transactionSync(() => {
let key = [this.sharedStructuresKey, id];
let existingStructuresBuffer = this.getBinary(key);
let existingStructures = existingStructuresBuffer && this.decoder.decode(existingStructuresBuffer);
if (typeof isCompatible == 'function' ?
!isCompatible(existingStructures) :
(existingStructures && existingStructures.length != isCompatible))
return false; // it changed, we need to indicate that we couldn't update
this.put(key, structure);
}, options.overlappingSync ? 0x10000 : 0);
},
copyBuffers: true, // need to copy any embedded buffers that are found since we use unsafe buffers

@@ -351,0 +372,0 @@ };

{
"name": "lmdb",
"author": "Kris Zyp",
"version": "2.6.0-alpha5",
"version": "2.6.0-alpha6",
"description": "Simple, efficient, scalable, high-performance LMDB interface",

@@ -30,2 +30,6 @@ "license": "MIT",

},
"types": {
"require": "./index.d.cts",
"import": "./index.d.ts"
},
"default": "./index.js"

@@ -57,3 +61,3 @@ }

"build": "node-gyp configure && node-gyp build && rollup -c",
"rebuild": "node-gyp build && rollup -c",
"rebuild": "node-gyp build && rollup -c && cpy index.d.ts . --rename=index.d.cts",
"build-js": "rollup -c",

@@ -88,2 +92,3 @@ "prepare": "rollup -c",

"chai": "^4.3.4",
"cpy-cli": "^4.1.0",
"fs-extra": "^9.0.1",

@@ -105,9 +110,9 @@ "mocha": "^9.1.3",

"optionalDependencies": {
"@lmdb/lmdb-darwin-arm64": "2.6.0-alpha5",
"@lmdb/lmdb-darwin-x64": "2.6.0-alpha5",
"@lmdb/lmdb-linux-arm": "2.6.0-alpha5",
"@lmdb/lmdb-linux-arm64": "2.6.0-alpha5",
"@lmdb/lmdb-linux-x64": "2.6.0-alpha5",
"@lmdb/lmdb-win32-x64": "2.6.0-alpha5"
"@lmdb/lmdb-darwin-arm64": "2.6.0-alpha6",
"@lmdb/lmdb-darwin-x64": "2.6.0-alpha6",
"@lmdb/lmdb-linux-arm": "2.6.0-alpha6",
"@lmdb/lmdb-linux-arm64": "2.6.0-alpha6",
"@lmdb/lmdb-linux-x64": "2.6.0-alpha6",
"@lmdb/lmdb-win32-x64": "2.6.0-alpha6"
}
}

@@ -44,7 +44,7 @@ import { getAddress, write, compress } from './native.js';

let uint32 = dynamicBytes.uint32 = new Uint32Array(buffer, 0, WRITE_BUFFER_SIZE >> 2);
uint32[0] = 0;
uint32[2] = 0;
dynamicBytes.float64 = new Float64Array(buffer, 0, WRITE_BUFFER_SIZE >> 3);
buffer.address = getAddress(dynamicBytes);
uint32.address = buffer.address + uint32.byteOffset;
dynamicBytes.position = 0;
dynamicBytes.position = 1; // we start at position 1 to save space for writing the txn id before the txn delimiter
return dynamicBytes;

@@ -75,9 +75,10 @@ }

allocateInstructionBuffer();
dynamicBytes.uint32[0] = TXN_DELIMITER | TXN_COMMITTED | TXN_FLUSHED;
var txnResolution, lastQueuedResolution, nextResolution = {
uint32: dynamicBytes.uint32, flagPosition: 0, flag: 0, valueBuffer: null, next: null, meta: null };
dynamicBytes.uint32[2] = TXN_DELIMITER | TXN_COMMITTED | TXN_FLUSHED;
var txnResolution, nextResolution = {
uint32: dynamicBytes.uint32, flagPosition: 2, flag: 0, valueBuffer: null, next: null, meta: null };
var uncommittedResolution = {
uint32: null, flagPosition: 0, flag: 0, valueBuffer: null, next: nextResolution, meta: null };
uint32: null, flagPosition: 2, flag: 0, valueBuffer: null, next: nextResolution, meta: null };
var unwrittenResolution = nextResolution;
var lastPromisedResolution = uncommittedResolution;
var lastQueuedResolution = uncommittedResolution;
let lastValue, valueBuffer;

@@ -236,3 +237,3 @@ function writeInstructions(flags, store, key, value, version, ifVersion) {

position = targetBytes.position;
float64[lastPosition + 1] = targetBytes.uint32.address + position;
float64[lastPosition + 1] = targetBytes.uint32.address + (position << 3);
uint32[lastPosition << 1] = 3; // pointer instruction

@@ -469,3 +470,3 @@ nextUint32 = targetBytes.uint32;

function resolveCommit(async) {
afterCommit(txnResolution.uint32[txnResolution.flagPosition + 1]);
afterCommit(txnResolution.uint32[txnResolution.flagPosition - 1]);
if (async)

@@ -527,15 +528,8 @@ resetReadTxn();

let promises;
let txnCallbacks;
for (let i = 0, l = nextTxnCallbacks.length; i < l; i++) {
txnCallbacks = nextTxnCallbacks[i];
for (let i = 0, l = txnCallbacks.length; i < l; i++) {
let userTxnCallback = txnCallbacks[i];
let txnCallbacks = nextTxnCallbacks[i];
for (let j = 0, l = txnCallbacks.length; j < l; j++) {
let userTxnCallback = txnCallbacks[j];
let asChild = userTxnCallback.asChild;
if (asChild) {
if (promises) {
// must complete any outstanding transactions before proceeding
hasUnresolvedTxns = true;
await Promise.all(promises);
promises = null;
}
env.beginTxn(1); // abortable

@@ -555,7 +549,7 @@ let parentTxn = writeTxn;

clearWriteTxn(parentTxn);
txnCallbacks[i] = result;
txnCallbacks[j] = result;
} catch(error) {
clearWriteTxn(parentTxn);
env.abortTxn();
txnError(error, i);
txnError(error, txnCallbacks, j);
}

@@ -565,10 +559,9 @@ } else {

let result = userTxnCallback();
txnCallbacks[i] = result;
txnCallbacks[j] = result;
if (result && result.then) {
if (!promises)
promises = [];
promises.push(result.catch(() => {}));
hasUnresolvedTxns = true;
await result;
}
} catch(error) {
txnError(error, i);
txnError(error, txnCallbacks, j);
}

@@ -579,6 +572,2 @@ }

nextTxnCallbacks = [];
if (promises) { // finish any outstanding commit functions
hasUnresolvedTxns = true;
await Promise.all(promises);
}
clearWriteTxn(null);

@@ -588,3 +577,3 @@ if (hasUnresolvedTxns) {

}
function txnError(error, i) {
function txnError(error, txnCallbacks, i) {
(txnCallbacks.errors || (txnCallbacks.errors = []))[i] = error;

@@ -781,3 +770,3 @@ txnCallbacks[i] = CALLBACK_THREW;

let txnCallbacks;
if (!nextResolution.callbacks) {
if (!lastQueuedResolution.callbacks) {
txnCallbacks = [asChild ? { callback, asChild } : callback];

@@ -784,0 +773,0 @@ nextResolution.callbacks = txnCallbacks;

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

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

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc