Comparing version 2.6.0-alpha7 to 2.6.0-beta1
@@ -10,5 +10,4 @@ declare namespace lmdb { | ||
* @param id The key for the entry | ||
* @param options Extra settings for the get | ||
**/ | ||
get(id: K, options?: {}): V | undefined | ||
get(id: K): V | undefined | ||
/** | ||
@@ -37,2 +36,11 @@ * Get the entry stored by given id/key, which includes both the value and the version number (if available) | ||
/** | ||
* For random access structures and "fast" binary data, the underlying data is volatile, | ||
* and not safe to access after the next get. This function allows the data to | ||
* be copied as needed for safe access in the future. This can be used with buffers and random | ||
* access data structures. | ||
* @param data The data to be copied | ||
**/ | ||
retain(data: any): any | ||
/** | ||
* Asynchronously fetch the values stored by the given ids and accesses all | ||
@@ -39,0 +47,0 @@ * pages to ensure that any hard page faults and disk I/O are performed |
{ | ||
"name": "lmdb", | ||
"author": "Kris Zyp", | ||
"version": "2.6.0-alpha7", | ||
"version": "2.6.0-beta1", | ||
"description": "Simple, efficient, scalable, high-performance LMDB interface", | ||
@@ -80,3 +80,3 @@ "license": "MIT", | ||
"dependencies": { | ||
"msgpackr": "^1.7.0-alpha5", | ||
"msgpackr": "^1.7.0-beta1", | ||
"node-addon-api": "^4.3.0", | ||
@@ -108,9 +108,9 @@ "node-gyp-build-optional-packages": "5.0.3", | ||
"optionalDependencies": { | ||
"@lmdb/lmdb-darwin-arm64": "2.6.0-alpha7", | ||
"@lmdb/lmdb-darwin-x64": "2.6.0-alpha7", | ||
"@lmdb/lmdb-linux-arm": "2.6.0-alpha7", | ||
"@lmdb/lmdb-linux-arm64": "2.6.0-alpha7", | ||
"@lmdb/lmdb-linux-x64": "2.6.0-alpha7", | ||
"@lmdb/lmdb-win32-x64": "2.6.0-alpha7" | ||
"@lmdb/lmdb-darwin-arm64": "2.6.0-beta1", | ||
"@lmdb/lmdb-darwin-x64": "2.6.0-beta1", | ||
"@lmdb/lmdb-linux-arm": "2.6.0-beta1", | ||
"@lmdb/lmdb-linux-arm64": "2.6.0-beta1", | ||
"@lmdb/lmdb-linux-x64": "2.6.0-beta1", | ||
"@lmdb/lmdb-win32-x64": "2.6.0-beta1" | ||
} | ||
} |
21
read.js
@@ -10,7 +10,9 @@ import { RangeIterable } from './util/RangeIterable.js'; | ||
if (!getValueBytes.maxLength) { | ||
getValueBytes.maxLength = getValueBytes.length; | ||
Object.defineProperty(getValueBytes, 'length', { value: getValueBytes.length, writable: true, configurable: true }); | ||
getValueBytes.maxLength = getValueBytes.length; | ||
getValueBytes.isGlobal = true; | ||
Object.defineProperty(getValueBytes, 'length', { value: getValueBytes.length, writable: true, configurable: true }); | ||
} | ||
const START_ADDRESS_POSITION = 4064; | ||
const NEW_BUFFER_THRESHOLD = 0x8000; | ||
const SOURCE_SYMBOL = Symbol.for('source'); | ||
export const UNMODIFIED = {}; | ||
@@ -102,5 +104,7 @@ | ||
}, | ||
retainBinary(buffer) { | ||
if (!buffer) | ||
retain(data) { | ||
if (!data) | ||
return | ||
let source = data[SOURCE_SYMBOL]; | ||
let buffer = source ? source.bytes : data; | ||
if (!buffer.isGlobal && !env.writeTxn) { | ||
@@ -110,5 +114,10 @@ let txn = explicitTxn || (readTxnRenewed ? readTxn : renewReadTxn(this)); | ||
txn.refCount = (txn.refCount || 0) + 1; | ||
return buffer; | ||
return data; | ||
} else { | ||
return Uint8ArraySlice.call(buffer, 0, this.lastSize); | ||
buffer = Uint8ArraySlice.call(buffer, 0, this.lastSize); | ||
if (source) { | ||
source.bytes = buffer; | ||
return data; | ||
} else | ||
return buffer; | ||
} | ||
@@ -115,0 +124,0 @@ }, |
const SKIP = {}; | ||
const DONE = { | ||
value: null, | ||
done: true, | ||
} | ||
if (!Symbol.asyncIterator) { | ||
@@ -17,2 +21,3 @@ Symbol.asyncIterator = Symbol.for('Symbol.asyncIterator'); | ||
let iterator = source[Symbol.iterator](async); | ||
let i = 0; | ||
return { | ||
@@ -36,6 +41,6 @@ next(resolvedResult) { | ||
} | ||
result = func(iteratorResult.value); | ||
result = func(iteratorResult.value, i++); | ||
if (result && result.then) { | ||
return result.then(result => | ||
result == SKIP ? | ||
result === SKIP ? | ||
this.next() : | ||
@@ -46,3 +51,6 @@ { | ||
} | ||
} while(result == SKIP) | ||
} while(result === SKIP) | ||
if (result === DONE) { | ||
return result; | ||
} | ||
return { | ||
@@ -105,2 +113,13 @@ value: result | ||
} | ||
slice(start, end) { | ||
return this.map((element, i) => { | ||
if (i < start) | ||
return SKIP; | ||
if (i >= end) { | ||
DONE.value = element; | ||
return DONE; | ||
} | ||
return element; | ||
}); | ||
} | ||
next() { | ||
@@ -107,0 +126,0 @@ if (!this.iterator) |
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
2277474
5833
+ Added@lmdb/lmdb-darwin-arm64@2.6.0-beta1(transitive)
+ Added@lmdb/lmdb-darwin-x64@2.6.0-beta1(transitive)
+ Added@lmdb/lmdb-linux-arm@2.6.0-beta1(transitive)
+ Added@lmdb/lmdb-linux-arm64@2.6.0-beta1(transitive)
+ Added@lmdb/lmdb-linux-x64@2.6.0-beta1(transitive)
+ Added@lmdb/lmdb-win32-x64@2.6.0-beta1(transitive)
- Removed@lmdb/lmdb-darwin-arm64@2.6.0-alpha7(transitive)
- Removed@lmdb/lmdb-darwin-x64@2.6.0-alpha7(transitive)
- Removed@lmdb/lmdb-linux-arm@2.6.0-alpha7(transitive)
- Removed@lmdb/lmdb-linux-arm64@2.6.0-alpha7(transitive)
- Removed@lmdb/lmdb-linux-x64@2.6.0-alpha7(transitive)
- Removed@lmdb/lmdb-win32-x64@2.6.0-alpha7(transitive)
Updatedmsgpackr@^1.7.0-beta1