From 5f7058a49a30aa6a19941294599c83e2553a2bec Mon Sep 17 00:00:00 2001 From: Vincent Weevers Date: Fri, 27 Mar 2020 11:56:16 +0300 Subject: [PATCH 01/25] Cirrus CI: upgrade to FreeBSD 12.1 (#712) --- .cirrus.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.cirrus.yml b/.cirrus.yml index 89acf288..addd6c5f 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -1,5 +1,5 @@ freebsd_instance: - image_family: freebsd-12-0 + image_family: freebsd-12-1 task: name: FreeBSD From 91711fa61d3e3666633a554c3ce59407c3b1c7dc Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Fri, 27 Mar 2020 09:18:22 +0000 Subject: [PATCH 02/25] Bump node-gyp-build from 4.1.1 to 4.2.1 (#708) --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9b0b6465..e1c37dfd 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "dependencies": { "abstract-leveldown": "~6.2.1", "napi-macros": "~2.0.0", - "node-gyp-build": "~4.1.0" + "node-gyp-build": "~4.2.1" }, "devDependencies": { "async-each": "^1.0.3", From 9da129cb485a4f77cb3f3496d7331eb59db12d84 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Fri, 23 Oct 2020 08:25:08 +0200 Subject: [PATCH 03/25] Bump prebuildify-cross from v4.0.0 to 4.0.0 (#741) --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e1c37dfd..bf60d838 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,7 @@ "nyc": "^15.0.0", "prebuildify": "^3.0.0", "prebuildify-ci": "^1.0.4", - "prebuildify-cross": "github:prebuild/prebuildify-cross#v4.0.0", + "prebuildify-cross": "^4.0.0", "readfiletree": "^1.0.0", "rimraf": "^3.0.0", "standard": "^14.0.0", From 2fb5ff2080f0d9d26377d1614448e752ffb585ba Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Sat, 24 Oct 2020 07:24:46 +0000 Subject: [PATCH 04/25] Bump prebuildify from 3.0.4 to 4.1.0 (#738) --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index bf60d838..cc453659 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,7 @@ "mkfiletree": "^2.0.0", "node-gyp": "^6.0.0", "nyc": "^15.0.0", - "prebuildify": "^3.0.0", + "prebuildify": "^4.1.0", "prebuildify-ci": "^1.0.4", "prebuildify-cross": "^4.0.0", "readfiletree": "^1.0.0", From fe54e731e66dca407c7d5fa09166ce34e14ce17d Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Sat, 24 Oct 2020 07:26:32 +0000 Subject: [PATCH 05/25] Bump electron from 8.5.2 to 10.1.5 (#746) --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index cc453659..97ed7d92 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "delayed": "^2.0.0", "dependency-check": "^4.1.0", "du": "^1.0.0", - "electron": "^8.0.0", + "electron": "^10.1.5", "faucet": "^0.0.1", "glob": "^7.1.3", "hallmark": "^2.0.0", From d39e232d0bf71f2eeaa10b9e9cf254206f529241 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Sat, 24 Oct 2020 08:17:55 +0000 Subject: [PATCH 06/25] Bump standard from 14.3.4 to 15.0.0 (#745) --- package.json | 2 +- test/leak-tester-batch.js | 30 +++++++++++++++--------------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/package.json b/package.json index 97ed7d92..1a8d86a3 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,7 @@ "prebuildify-cross": "^4.0.0", "readfiletree": "^1.0.0", "rimraf": "^3.0.0", - "standard": "^14.0.0", + "standard": "^15.0.0", "tape": "^4.10.0", "tempy": "^0.3.0" }, diff --git a/test/leak-tester-batch.js b/test/leak-tester-batch.js index f52f7676..9e43e406 100644 --- a/test/leak-tester-batch.js +++ b/test/leak-tester-batch.js @@ -25,24 +25,24 @@ function print () { const run = CHAINED ? function () { - const batch = db.batch() + const batch = db.batch() - for (let i = 0; i < 100; i++) { - let key = 'long key to test memory usage ' + String(Math.floor(Math.random() * 10000000)) - if (BUFFERS) key = Buffer.from(key) - let value = crypto.randomBytes(1024) - if (!BUFFERS) value = value.toString('hex') - batch.put(key, value) - } + for (let i = 0; i < 100; i++) { + let key = 'long key to test memory usage ' + String(Math.floor(Math.random() * 10000000)) + if (BUFFERS) key = Buffer.from(key) + let value = crypto.randomBytes(1024) + if (!BUFFERS) value = value.toString('hex') + batch.put(key, value) + } - batch.write(function (err) { - assert(!err) - process.nextTick(run) - }) + batch.write(function (err) { + assert(!err) + process.nextTick(run) + }) - writeCount++ - print() - } + writeCount++ + print() + } : function () { const batch = [] From f4be05e75662ae0390ed5f624efaf6a5137b3aa1 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Sun, 25 Oct 2020 07:33:19 +0000 Subject: [PATCH 07/25] Bump hallmark from 2.1.0 to 3.0.0 (#735) --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 1a8d86a3..99df5b3c 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ "electron": "^10.1.5", "faucet": "^0.0.1", "glob": "^7.1.3", - "hallmark": "^2.0.0", + "hallmark": "^3.0.0", "level-community": "^3.0.0", "level-concat-iterator": "^2.0.0", "mkfiletree": "^2.0.0", From 906017f57626b61fc6f3ab5c94e4d502612dee69 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Tue, 17 Nov 2020 09:33:37 +0000 Subject: [PATCH 08/25] Bump electron from 10.1.5 to 11.0.0 (#749) --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 99df5b3c..826fe974 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "delayed": "^2.0.0", "dependency-check": "^4.1.0", "du": "^1.0.0", - "electron": "^10.1.5", + "electron": "^11.0.0", "faucet": "^0.0.1", "glob": "^7.1.3", "hallmark": "^3.0.0", From e43da1fc2f4d0da9256627f317c91b6b494200e3 Mon Sep 17 00:00:00 2001 From: Vincent Weevers Date: Tue, 24 Nov 2020 22:33:10 +0100 Subject: [PATCH 09/25] Configure dependabot (#750) --- .github/dependabot.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..97562b91 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,16 @@ +version: 2 +updates: + - package-ecosystem: npm + directory: / + schedule: + interval: monthly + ignore: + - dependency-name: dependency-check + - dependency-name: cross-env + - dependency-name: node-gyp + - dependency-name: standard + - dependency-name: tempy + - package-ecosystem: gitsubmodule + directory: / + schedule: + interval: monthly From 7f2fff1d33178ad03f922f22495df8840f972037 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Wed, 25 Nov 2020 09:40:30 +0000 Subject: [PATCH 10/25] Bump tape from 4.13.3 to 5.0.1 (#718) --- package.json | 2 +- test/approximate-size-test.js | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 826fe974..c6995db6 100644 --- a/package.json +++ b/package.json @@ -50,7 +50,7 @@ "readfiletree": "^1.0.0", "rimraf": "^3.0.0", "standard": "^15.0.0", - "tape": "^4.10.0", + "tape": "^5.0.1", "tempy": "^0.3.0" }, "hallmark": { diff --git a/test/approximate-size-test.js b/test/approximate-size-test.js index 06dced35..159bd92a 100644 --- a/test/approximate-size-test.js +++ b/test/approximate-size-test.js @@ -13,7 +13,7 @@ test('setUp db', function (t) { test('test argument-less approximateSize() throws', function (t) { t.throws( db.approximateSize.bind(db) - , { name: 'Error', message: 'approximateSize() requires valid `start`, `end` and `callback` arguments' } + , /^Error: approximateSize\(\) requires valid `start` and `end` arguments/ , 'no-arg approximateSize() throws' ) t.end() @@ -22,7 +22,7 @@ test('test argument-less approximateSize() throws', function (t) { test('test callback-less, 1-arg, approximateSize() throws', function (t) { t.throws( db.approximateSize.bind(db, 'foo') - , { name: 'Error', message: 'approximateSize() requires valid `start`, `end` and `callback` arguments' } + , /^Error: approximateSize\(\) requires valid `start` and `end` arguments/ , 'callback-less, 1-arg approximateSize() throws' ) t.end() @@ -31,7 +31,7 @@ test('test callback-less, 1-arg, approximateSize() throws', function (t) { test('test callback-less, 2-arg, approximateSize() throws', function (t) { t.throws( db.approximateSize.bind(db, 'foo', 'bar') - , { name: 'Error', message: 'approximateSize() requires a callback argument' } + , /^Error: approximateSize\(\) requires a callback argument/ , 'callback-less, 2-arg approximateSize() throws' ) t.end() @@ -40,7 +40,7 @@ test('test callback-less, 2-arg, approximateSize() throws', function (t) { test('test callback-less, 3-arg, approximateSize() throws', function (t) { t.throws( db.approximateSize.bind(db, function () {}) - , { name: 'Error', message: 'approximateSize() requires valid `start`, `end` and `callback` arguments' } + , /^Error: approximateSize\(\) requires valid `start` and `end` arguments/ , 'callback-only approximateSize() throws' ) t.end() @@ -49,7 +49,7 @@ test('test callback-less, 3-arg, approximateSize() throws', function (t) { test('test callback-only approximateSize() throws', function (t) { t.throws( db.approximateSize.bind(db, function () {}) - , { name: 'Error', message: 'approximateSize() requires valid `start`, `end` and `callback` arguments' } + , /^Error: approximateSize\(\) requires valid `start` and `end` arguments/ , 'callback-only approximateSize() throws' ) t.end() @@ -58,7 +58,7 @@ test('test callback-only approximateSize() throws', function (t) { test('test 1-arg + callback approximateSize() throws', function (t) { t.throws( db.approximateSize.bind(db, 'foo', function () {}) - , { name: 'Error', message: 'approximateSize() requires valid `start`, `end` and `callback` arguments' } + , /^Error: approximateSize\(\) requires valid `start` and `end` arguments/ , '1-arg + callback approximateSize() throws' ) t.end() From 344cb1b03b2bbf8dc4b71162c3050ddfbdac5250 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 13 Apr 2020 08:09:11 +0000 Subject: [PATCH 11/25] Bump abstract-leveldown from 6.2.3 to 6.3.0 Bumps [abstract-leveldown](https://github.com/Level/abstract-leveldown) from 6.2.3 to 6.3.0. - [Release notes](https://github.com/Level/abstract-leveldown/releases) - [Changelog](https://github.com/Level/abstract-leveldown/blob/master/CHANGELOG.md) - [Commits](https://github.com/Level/abstract-leveldown/compare/v6.2.3...v6.3.0) Signed-off-by: dependabot-preview[bot] --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c6995db6..35005b9a 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "prebuild-darwin-x64": "prebuildify -t 8.14.0 --napi --strip" }, "dependencies": { - "abstract-leveldown": "~6.2.1", + "abstract-leveldown": "^6.3.0", "napi-macros": "~2.0.0", "node-gyp-build": "~4.2.1" }, From 55a33b11f58c0c978115d9c1990ea72647b21a3a Mon Sep 17 00:00:00 2001 From: Vincent Weevers Date: Wed, 25 Nov 2020 11:50:04 +0100 Subject: [PATCH 12/25] Skip stack exhaustion test --- test/iterator-recursion-test.js | 42 ++++++++++++++++++++++----------- 1 file changed, 28 insertions(+), 14 deletions(-) diff --git a/test/iterator-recursion-test.js b/test/iterator-recursion-test.js index 15249b73..84b40f0b 100644 --- a/test/iterator-recursion-test.js +++ b/test/iterator-recursion-test.js @@ -22,23 +22,37 @@ const sourceData = (function () { test('setUp common', testCommon.setUp) -test('try to create an iterator with a blown stack', function (t) { - // Reducing the stack size down from the default 984 for the child node - // process makes it easier to trigger the bug condition. But making it too low - // causes the child process to die for other reasons. - var opts = { execArgv: ['--stack-size=128'] } - var child = fork(path.join(__dirname, 'stack-blower.js'), ['run'], opts) +// TODO: fix this test. It asserted that we didn't segfault if user code had an +// infinite loop leading to stack exhaustion, which caused a node::FatalException() +// call in our Iterator to segfault. This was fixed in 2014 (commit 85e6a38). +// +// Today (2020), we see occasional failures in CI again. We no longer call +// node::FatalException() so there's a new reason. Possibly related to +// https://github.com/Level/leveldown/issues/667. +test.skip('try to create an iterator with a blown stack', function (t) { + for (let i = 0; i < 100; i++) { + t.test(`try to create an iterator with a blown stack (${i})`, function (t) { + t.plan(3) - t.plan(2) + // Reducing the stack size down from the default 984 for the child node + // process makes it easier to trigger the bug condition. But making it too low + // causes the child process to die for other reasons. + var opts = { execArgv: ['--stack-size=128'] } + var child = fork(path.join(__dirname, 'stack-blower.js'), ['run'], opts) - child.on('message', function (m) { - t.ok(true, m) - child.disconnect() - }) + child.on('message', function (m) { + t.ok(true, m) + child.disconnect() + }) - child.on('exit', function (code, sig) { - t.equal(code, 0, 'child exited normally') - }) + child.on('exit', function (code, sig) { + t.is(code, 0, 'child exited normally') + t.is(sig, null, 'not terminated due to signal') + }) + }) + } + + t.end() }) test('setUp db', function (t) { From a7893e44c9732132f0a938128011ecc240f480dc Mon Sep 17 00:00:00 2001 From: Vincent Weevers Date: Fri, 1 Jan 2021 08:58:51 +0100 Subject: [PATCH 13/25] Disable dependabot on git submodules --- .github/dependabot.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 97562b91..becce3fe 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -10,7 +10,3 @@ updates: - dependency-name: node-gyp - dependency-name: standard - dependency-name: tempy - - package-ecosystem: gitsubmodule - directory: / - schedule: - interval: monthly From 18ccfcbb891228d870e44b3385d0091ba938a202 Mon Sep 17 00:00:00 2001 From: Vincent Weevers Date: Sun, 4 Apr 2021 11:44:06 +0200 Subject: [PATCH 14/25] Upgrade FreeBSD in CI from 12.1 to 12.2 (#760) --- .cirrus.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index addd6c5f..934a051c 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -1,10 +1,10 @@ freebsd_instance: - image_family: freebsd-12-1 + image_family: freebsd-12-2 task: name: FreeBSD provision_script: - - pkg install -y git libnghttp2 node npm + - pkg install -y git node npm install_script: - git submodule update --init --recursive - env ELECTRON_SKIP_BINARY_DOWNLOAD=1 npm i --unsafe-perm From 6c2ecd76a428efe3a3069b4d9b4316989ba82caa Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 4 Apr 2021 10:29:14 +0000 Subject: [PATCH 15/25] Bump electron from 11.4.1 to 12.0.2 (#759) --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 35005b9a..bf8e4f26 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "delayed": "^2.0.0", "dependency-check": "^4.1.0", "du": "^1.0.0", - "electron": "^11.0.0", + "electron": "^12.0.2", "faucet": "^0.0.1", "glob": "^7.1.3", "hallmark": "^3.0.0", From 39e3ca34864c9fc55a70bb3359e99341752ed041 Mon Sep 17 00:00:00 2001 From: Vincent Weevers Date: Fri, 9 Apr 2021 23:41:10 +0200 Subject: [PATCH 16/25] Bump standard from 15.x to 16.x --- .github/dependabot.yml | 1 - chained-batch.js | 2 ++ iterator.js | 12 ++++++------ leveldown.js | 2 ++ package.json | 2 +- test/approximate-size-test.js | 6 +++--- test/cleanup-hanging-iterators-test.js | 10 +++++----- test/compact-range-test.js | 12 ++++++------ test/compression-test.js | 8 ++++---- test/destroy-test.js | 14 +++++++------- test/getproperty-test.js | 4 ++-- test/iterator-recursion-test.js | 14 +++++++------- test/iterator-test.js | 18 +++++++++--------- test/leak-tester-iterator.js | 2 +- test/make.js | 4 ++-- test/port-libuv-fix-test.js | 5 ++--- test/repair-test.js | 4 ++-- test/stack-blower.js | 4 ++-- 18 files changed, 63 insertions(+), 61 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index becce3fe..809d16bc 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -8,5 +8,4 @@ updates: - dependency-name: dependency-check - dependency-name: cross-env - dependency-name: node-gyp - - dependency-name: standard - dependency-name: tempy diff --git a/chained-batch.js b/chained-batch.js index 0bd9a673..ab7a743c 100644 --- a/chained-batch.js +++ b/chained-batch.js @@ -1,3 +1,5 @@ +'use strict' + const util = require('util') const AbstractChainedBatch = require('abstract-leveldown').AbstractChainedBatch const binding = require('./binding') diff --git a/iterator.js b/iterator.js index 2115eef2..2805c331 100644 --- a/iterator.js +++ b/iterator.js @@ -1,3 +1,5 @@ +'use strict' + const util = require('util') const AbstractIterator = require('abstract-leveldown').AbstractIterator const binding = require('./binding') @@ -23,19 +25,17 @@ Iterator.prototype._seek = function (target) { } Iterator.prototype._next = function (callback) { - var that = this - if (this.cache && this.cache.length) { process.nextTick(callback, null, this.cache.pop(), this.cache.pop()) } else if (this.finished) { process.nextTick(callback) } else { - binding.iterator_next(this.context, function (err, array, finished) { + binding.iterator_next(this.context, (err, array, finished) => { if (err) return callback(err) - that.cache = array - that.finished = finished - that._next(callback) + this.cache = array + this.finished = finished + this._next(callback) }) } diff --git a/leveldown.js b/leveldown.js index efb31f62..ad7d0abe 100644 --- a/leveldown.js +++ b/leveldown.js @@ -1,3 +1,5 @@ +'use strict' + const util = require('util') const AbstractLevelDOWN = require('abstract-leveldown').AbstractLevelDOWN const binding = require('./binding') diff --git a/package.json b/package.json index bf8e4f26..d3e4e171 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,7 @@ "prebuildify-cross": "^4.0.0", "readfiletree": "^1.0.0", "rimraf": "^3.0.0", - "standard": "^15.0.0", + "standard": "^16.0.3", "tape": "^5.0.1", "tempy": "^0.3.0" }, diff --git a/test/approximate-size-test.js b/test/approximate-size-test.js index 159bd92a..e1adc4d4 100644 --- a/test/approximate-size-test.js +++ b/test/approximate-size-test.js @@ -1,7 +1,7 @@ const test = require('tape') const testCommon = require('./common') -var db +let db test('setUp common for approximate size', testCommon.setUp) @@ -66,7 +66,7 @@ test('test 1-arg + callback approximateSize() throws', function (t) { test('test custom _serialize*', function (t) { t.plan(4) - var db = testCommon.factory() + const db = testCommon.factory() db._serializeKey = function (data) { return data } db.approximateSize = function (start, end, callback) { t.deepEqual(start, { foo: 'bar' }) @@ -82,7 +82,7 @@ test('test custom _serialize*', function (t) { }) test('test approximateSize()', function (t) { - var data = Array.apply(null, Array(10000)).map(function () { + const data = Array.apply(null, Array(10000)).map(function () { return 'aaaaaaaaaa' }).join('') diff --git a/test/cleanup-hanging-iterators-test.js b/test/cleanup-hanging-iterators-test.js index 5ff54103..89578a28 100644 --- a/test/cleanup-hanging-iterators-test.js +++ b/test/cleanup-hanging-iterators-test.js @@ -3,7 +3,7 @@ const repeats = 200 makeTest('test ended iterator', function (db, t, done) { // First test normal and proper usage: calling it.end() before db.close() - var it = db.iterator({ keyAsBuffer: false, valueAsBuffer: false }) + const it = db.iterator({ keyAsBuffer: false, valueAsBuffer: false }) it.next(function (err, key, value) { t.ifError(err, 'no error from next()') @@ -19,7 +19,7 @@ makeTest('test ended iterator', function (db, t, done) { makeTest('test likely-ended iterator', function (db, t, done) { // Test improper usage: not calling it.end() before db.close(). Cleanup of the // database will crash Node if not handled properly. - var it = db.iterator({ keyAsBuffer: false, valueAsBuffer: false }) + const it = db.iterator({ keyAsBuffer: false, valueAsBuffer: false }) it.next(function (err, key, value) { t.ifError(err, 'no error from next()') @@ -33,7 +33,7 @@ makeTest('test non-ended iterator', function (db, t, done) { // Same as the test above but with a highWaterMark of 0 so that we don't // preemptively fetch all records, to ensure that the iterator is still // active when we (attempt to) close the database. - var it = db.iterator({ + const it = db.iterator({ highWaterMark: 0, keyAsBuffer: false, valueAsBuffer: false @@ -84,10 +84,10 @@ global.gc && makeTest('test multiple non-ended iterators with forced gc', functi makeTest('test ending iterators', function (db, t, done) { // At least one end() should be in progress when we try to close the db. - var it1 = db.iterator().next(function () { + const it1 = db.iterator().next(function () { it1.end(function () {}) }) - var it2 = db.iterator().next(function () { + const it2 = db.iterator().next(function () { it2.end(function () {}) done() }) diff --git a/test/compact-range-test.js b/test/compact-range-test.js index f4fe4d57..286da619 100644 --- a/test/compact-range-test.js +++ b/test/compact-range-test.js @@ -11,10 +11,10 @@ test('setUp db', function (t) { }) test('test compactRange() frees disk space after key deletion', function (t) { - var key1 = '000000' - var key2 = '000001' - var val1 = Buffer.allocUnsafe(64).fill(1) - var val2 = Buffer.allocUnsafe(64).fill(1) + const key1 = '000000' + const key2 = '000001' + const val1 = Buffer.allocUnsafe(64).fill(1) + const val2 = Buffer.allocUnsafe(64).fill(1) db.batch().put(key1, val1).put(key2, val2).write(function (err) { t.ifError(err, 'no batch put error') @@ -46,8 +46,8 @@ test('test compactRange() frees disk space after key deletion', function (t) { test('test compactRange() serializes start and end', function (t) { t.plan(3) - var clone = Object.create(db) - var count = 0 + const clone = Object.create(db) + let count = 0 clone._serializeKey = function (key) { t.is(key, count++) diff --git a/test/compression-test.js b/test/compression-test.js index 63c715da..e233f0d8 100644 --- a/test/compression-test.js +++ b/test/compression-test.js @@ -26,7 +26,7 @@ const verify = function (location, compression, t) { // close, open, close again.. 'compaction' is also performed on open()s const cycle = function (db, compression, t, callback) { - var location = db.location + const location = db.location db.close(function (err) { t.error(err) db = leveldown(location) @@ -45,7 +45,7 @@ test('compression', function (t) { t.test('set up', testCommon.setUp) t.test('test data is compressed by default (db.put())', function (t) { - var db = testCommon.factory() + const db = testCommon.factory() db.open(function (err) { t.error(err) each( @@ -59,7 +59,7 @@ test('compression', function (t) { }) t.test('test data is not compressed with compression=false on open() (db.put())', function (t) { - var db = testCommon.factory() + const db = testCommon.factory() db.open({ compression: false }, function (err) { t.error(err) each( @@ -73,7 +73,7 @@ test('compression', function (t) { }) t.test('test data is compressed by default (db.batch())', function (t) { - var db = testCommon.factory() + const db = testCommon.factory() db.open(function (err) { t.error(err) db.batch( diff --git a/test/destroy-test.js b/test/destroy-test.js index 68029f48..be1dc2e8 100644 --- a/test/destroy-test.js +++ b/test/destroy-test.js @@ -27,8 +27,8 @@ test('test callback-less, 1-arg, destroy() throws', function (t) { test('test destroy non-existent directory', function (t) { t.plan(4) - var location = tempy.directory() - var parent = path.dirname(location) + const location = tempy.directory() + const parent = path.dirname(location) // For symmetry with the opposite test below. t.ok(fs.existsSync(parent), 'parent exists before') @@ -50,8 +50,8 @@ test('test destroy non-existent directory', function (t) { test('test destroy non-existent parent directory', function (t) { t.plan(3) - var location = '/1/2/3/4' - var parent = path.dirname(location) + const location = '/1/2/3/4' + const parent = path.dirname(location) t.notOk(fs.existsSync(parent), 'parent does not exist before') @@ -62,7 +62,7 @@ test('test destroy non-existent parent directory', function (t) { }) test('test destroy non leveldb directory', function (t) { - var tree = { + const tree = { foo: 'FOO', bar: { one: 'ONE', two: 'TWO', three: 'THREE' } } @@ -87,7 +87,7 @@ test('test destroy non leveldb directory', function (t) { }) makeTest('test destroy() cleans and removes leveldb-only dir', function (db, t, done) { - var location = db.location + const location = db.location db.close(function (err) { t.ifError(err, 'no error from close()') @@ -101,7 +101,7 @@ makeTest('test destroy() cleans and removes leveldb-only dir', function (db, t, }) makeTest('test destroy() cleans and removes only leveldb parts of a dir', function (db, t, done) { - var location = db.location + const location = db.location fs.writeFileSync(path.join(location, 'foo'), 'FOO') db.close(function (err) { diff --git a/test/getproperty-test.js b/test/getproperty-test.js index fa072c63..d27b1de0 100644 --- a/test/getproperty-test.js +++ b/test/getproperty-test.js @@ -33,7 +33,7 @@ test('test invalid getProperty() returns empty string', function (t) { }) test('test invalid getProperty("leveldb.num-files-at-levelN") returns numbers', function (t) { - for (var i = 0; i < 7; i++) { + for (let i = 0; i < 7; i++) { t.equal(db.getProperty('leveldb.num-files-at-level' + i), '0', '"leveldb.num-files-at-levelN" === "0"') } @@ -46,7 +46,7 @@ test('test invalid getProperty("leveldb.stats")', function (t) { }) test('test invalid getProperty("leveldb.sstables")', function (t) { - var expected = [0, 1, 2, 3, 4, 5, 6].map(function (l) { + const expected = [0, 1, 2, 3, 4, 5, 6].map(function (l) { return '--- level ' + l + ' ---' }).join('\n') + '\n' t.equal(db.getProperty('leveldb.sstables'), expected, 'leveldb.sstables') diff --git a/test/iterator-recursion-test.js b/test/iterator-recursion-test.js index 84b40f0b..aa4b96e1 100644 --- a/test/iterator-recursion-test.js +++ b/test/iterator-recursion-test.js @@ -6,9 +6,9 @@ const path = require('path') let db const sourceData = (function () { - var d = [] - var i = 0 - var k + const d = [] + let i = 0 + let k for (; i < 100000; i++) { k = (i < 10 ? '0' : '') + i d.push({ @@ -37,8 +37,8 @@ test.skip('try to create an iterator with a blown stack', function (t) { // Reducing the stack size down from the default 984 for the child node // process makes it easier to trigger the bug condition. But making it too low // causes the child process to die for other reasons. - var opts = { execArgv: ['--stack-size=128'] } - var child = fork(path.join(__dirname, 'stack-blower.js'), ['run'], opts) + const opts = { execArgv: ['--stack-size=128'] } + const child = fork(path.join(__dirname, 'stack-blower.js'), ['run'], opts) child.on('message', function (m) { t.ok(true, m) @@ -64,10 +64,10 @@ test('setUp db', function (t) { }) test('iterate over a large iterator with a large watermark', function (t) { - var iterator = db.iterator({ + const iterator = db.iterator({ highWaterMark: 10000000 }) - var read = function () { + const read = function () { iterator.next(function () { if (!arguments.length) { t.end() diff --git a/test/iterator-test.js b/test/iterator-test.js index 1a03b7cf..760e7360 100644 --- a/test/iterator-test.js +++ b/test/iterator-test.js @@ -3,12 +3,12 @@ const make = require('./make') // This test isn't included in abstract-leveldown because // the empty-check is currently performed by leveldown. make('iterator#seek throws if target is empty', function (db, t, done) { - var targets = ['', Buffer.alloc(0), []] - var pending = targets.length + const targets = ['', Buffer.alloc(0), []] + let pending = targets.length targets.forEach(function (target) { - var ite = db.iterator() - var error + const ite = db.iterator() + let error try { ite.seek(target) @@ -27,7 +27,7 @@ make('iterator#seek throws if target is empty', function (db, t, done) { }) make('iterator optimized for seek', function (db, t, done) { - var batch = db.batch() + const batch = db.batch() batch.put('a', 1) batch.put('b', 1) batch.put('c', 1) @@ -36,7 +36,7 @@ make('iterator optimized for seek', function (db, t, done) { batch.put('f', 1) batch.put('g', 1) batch.write(function (err) { - var ite = db.iterator() + const ite = db.iterator() t.ifError(err, 'no error from batch()') ite.next(function (err, key, value) { t.ifError(err, 'no error from next()') @@ -65,9 +65,9 @@ make('iterator optimized for seek', function (db, t, done) { }) make('close db with open iterator', function (db, t, done) { - var ite = db.iterator() - var cnt = 0 - var hadError = false + const ite = db.iterator() + let cnt = 0 + let hadError = false ite.next(function loop (err, key, value) { if (cnt++ === 0) { diff --git a/test/leak-tester-iterator.js b/test/leak-tester-iterator.js index 5e2cc593..604d7754 100644 --- a/test/leak-tester-iterator.js +++ b/test/leak-tester-iterator.js @@ -8,7 +8,7 @@ if (!global.gc) { } function run () { - var it = db.iterator() + const it = db.iterator() it.next(function (err) { if (err) throw err diff --git a/test/make.js b/test/make.js index 61fff6d3..ba260d3b 100644 --- a/test/make.js +++ b/test/make.js @@ -3,8 +3,8 @@ const testCommon = require('./common') function makeTest (name, testFn) { test(name, function (t) { - var db = testCommon.factory() - var done = function (err, close) { + const db = testCommon.factory() + const done = function (err, close) { t.ifError(err, 'no error from done()') if (close === false) { diff --git a/test/port-libuv-fix-test.js b/test/port-libuv-fix-test.js index 496d76a7..c928681f 100644 --- a/test/port-libuv-fix-test.js +++ b/test/port-libuv-fix-test.js @@ -3,13 +3,12 @@ const path = require('path') const fs = require('fs') test('test port-libuv is being used', function (t) { - var version = fs.readFileSync(path.join(__dirname, '../deps/leveldb/leveldb.gyp'), 'utf8') + const version = fs.readFileSync(path.join(__dirname, '../deps/leveldb/leveldb.gyp'), 'utf8') .match(/"ldbversion": "([^"]+)"/)[1] - var porth t.ok(version, 'matched current leveldb version') - porth = fs.readFileSync(path.join(__dirname, '../deps/leveldb/leveldb-' + version + '/port/port.h'), 'utf8') + const porth = fs.readFileSync(path.join(__dirname, '../deps/leveldb/leveldb-' + version + '/port/port.h'), 'utf8') t.ok(/"port_uv\.h"/.test(porth), 'port.h includes reference to port_uv.h') diff --git a/test/repair-test.js b/test/repair-test.js index 9dc03d48..6112c262 100644 --- a/test/repair-test.js +++ b/test/repair-test.js @@ -32,12 +32,12 @@ test('test repair non-existent directory returns error', function (t) { // a proxy indicator that RepairDB is being called and doing its thing makeTest('test repair() compacts', function (db, t, done) { - var location = db.location + const location = db.location db.close(function (err) { t.ifError(err, 'no error from close()') - var files = fs.readdirSync(location) + let files = fs.readdirSync(location) t.ok(files.some(function (f) { return (/\.log$/).test(f) }), 'directory contains log file(s)') t.notOk(files.some(function (f) { return (/\.ldb$/).test(f) }), 'directory does not contain ldb file(s)') diff --git a/test/stack-blower.js b/test/stack-blower.js index b802b0eb..24f0a18c 100644 --- a/test/stack-blower.js +++ b/test/stack-blower.js @@ -8,8 +8,8 @@ const testCommon = require('./common') if (process.argv[2] === 'run') { - var db = testCommon.factory() - var depth = 0 + const db = testCommon.factory() + let depth = 0 db.open(function () { function recurse () { From 8502b343b52f1ce70a272e43da507e2293838284 Mon Sep 17 00:00:00 2001 From: Vincent Weevers Date: Fri, 9 Apr 2021 23:47:55 +0200 Subject: [PATCH 17/25] Breaking: drop node 6 and 8 (Level/community#98) --- .travis.yml | 14 ++++++++++---- appveyor.yml | 2 +- package.json | 2 +- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 65fd8c45..be126be8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,10 +3,13 @@ language: node_js jobs: include: - os: linux - node_js: 8 + node_js: 10 env: [TEST=1] - os: linux - node_js: 10 + node_js: 12 + env: [TEST=1] + - os: linux + node_js: 14 env: [TEST=1] - os: linux node_js: node @@ -19,10 +22,13 @@ jobs: - export DISPLAY=':99.0' - Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 & - os: osx - node_js: 8 + node_js: 10 env: [TEST=1] - os: osx - node_js: 10 + node_js: 12 + env: [TEST=1] + - os: osx + node_js: 14 env: [TEST=1] - os: osx node_js: node diff --git a/appveyor.yml b/appveyor.yml index f22281fc..0bccd001 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -3,8 +3,8 @@ skip_branch_with_pr: true environment: matrix: - - nodejs_version: "8" - nodejs_version: "10" + - nodejs_version: "12" - nodejs_version: "Current" configuration: Release diff --git a/package.json b/package.json index d3e4e171..49ac361a 100644 --- a/package.json +++ b/package.json @@ -67,6 +67,6 @@ "level" ], "engines": { - "node": ">=8.6.0" + "node": ">=10" } } From 2dad78b3c14f960b83803eec8354475d728374b1 Mon Sep 17 00:00:00 2001 From: Vincent Weevers Date: Fri, 9 Apr 2021 23:48:40 +0200 Subject: [PATCH 18/25] Bump tempy --- .github/dependabot.yml | 1 - package.json | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 809d16bc..b7f7c9c3 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -8,4 +8,3 @@ updates: - dependency-name: dependency-check - dependency-name: cross-env - dependency-name: node-gyp - - dependency-name: tempy diff --git a/package.json b/package.json index 49ac361a..14066fcd 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,7 @@ "rimraf": "^3.0.0", "standard": "^16.0.3", "tape": "^5.0.1", - "tempy": "^0.3.0" + "tempy": "^1.0.1" }, "hallmark": { "community": "level-community" From bdfb17a0114aed7d7de541d7572a0d9fe7908349 Mon Sep 17 00:00:00 2001 From: Vincent Weevers Date: Fri, 9 Apr 2021 23:51:35 +0200 Subject: [PATCH 19/25] Bump cross-env --- .github/dependabot.yml | 1 - package.json | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index b7f7c9c3..8f9a8c67 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -6,5 +6,4 @@ updates: interval: monthly ignore: - dependency-name: dependency-check - - dependency-name: cross-env - dependency-name: node-gyp diff --git a/package.json b/package.json index 14066fcd..65521e7c 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "devDependencies": { "async-each": "^1.0.3", "coveralls": "^3.0.2", - "cross-env": "^6.0.0", + "cross-env": "^7.0.3", "delayed": "^2.0.0", "dependency-check": "^4.1.0", "du": "^1.0.0", From 39b9d3fa937b8683cccf1a537caf5edfa8ac1cab Mon Sep 17 00:00:00 2001 From: Vincent Weevers Date: Sat, 10 Apr 2021 00:09:45 +0200 Subject: [PATCH 20/25] Bump level-concat-iterator --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 65521e7c..70b70ba0 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "glob": "^7.1.3", "hallmark": "^3.0.0", "level-community": "^3.0.0", - "level-concat-iterator": "^2.0.0", + "level-concat-iterator": "^3.0.0", "mkfiletree": "^2.0.0", "node-gyp": "^6.0.0", "nyc": "^15.0.0", From 8bc56962a1f5ab9972aadefeee738248b5f73c7b Mon Sep 17 00:00:00 2001 From: Vincent Weevers Date: Sat, 10 Apr 2021 00:11:54 +0200 Subject: [PATCH 21/25] Bump node-gyp from 6.x to 7.x --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 70b70ba0..6710f3f2 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,7 @@ "level-community": "^3.0.0", "level-concat-iterator": "^3.0.0", "mkfiletree": "^2.0.0", - "node-gyp": "^6.0.0", + "node-gyp": "^7.1.2", "nyc": "^15.0.0", "prebuildify": "^4.1.0", "prebuildify-ci": "^1.0.4", @@ -67,6 +67,6 @@ "level" ], "engines": { - "node": ">=10" + "node": ">=10.12.0" } } From 15d5a9e2c69b720790a6077517460ef671b19530 Mon Sep 17 00:00:00 2001 From: Vincent Weevers Date: Sat, 10 Apr 2021 00:31:43 +0200 Subject: [PATCH 22/25] Breaking: bump abstract-leveldown Removes legacy ranges options (Level/community#86). --- README.md | 2 - binding.cc | 85 ++++++++++----------------------- package.json | 2 +- test/empty-range-option-test.js | 2 +- test/iterator-recursion-test.js | 6 ++- test/stack-blower.js | 2 +- 6 files changed, 33 insertions(+), 66 deletions(-) diff --git a/README.md b/README.md index fe360296..72d4f352 100644 --- a/README.md +++ b/README.md @@ -275,8 +275,6 @@ Returns a new [`iterator`](#iterator) instance. The optional `options` object ma - `lt` (less than), `lte` (less than or equal) define the higher bound of the range to be fetched and will determine the starting point where `reverse` is _not_ `true`. Only records where the key is less than (or equal to) this option will be included in the range. When `reverse` is `true` the order will be reversed, but the records returned will be the same. -- `start, end` legacy ranges - instead use `gte, lte` - - `reverse` _(boolean, default: `false`)_: a boolean, set to `true` if you want the stream to go in reverse order. Beware that due to the way LevelDB works, a reverse seek will be slower than a forward seek. - `keys` (boolean, default: `true`): whether the callback to the `next()` method should receive a non-null `key`. There is a small efficiency gain if you ultimately don't care what the keys are as they don't need to be converted and copied into JavaScript. diff --git a/binding.cc b/binding.cc index e938a40c..3d0ed733 100644 --- a/binding.cc +++ b/binding.cc @@ -499,8 +499,6 @@ struct PriorityWorker : public BaseWorker { struct Iterator { Iterator (Database* database, uint32_t id, - std::string* start, - std::string* end, bool reverse, bool keys, bool values, @@ -515,8 +513,6 @@ struct Iterator { uint32_t highWaterMark) : database_(database), id_(id), - start_(start), - end_(end), reverse_(reverse), keys_(keys), values_(values), @@ -544,8 +540,6 @@ struct Iterator { ~Iterator () { assert(ended_); - if (start_ != NULL) delete start_; - if (end_ != NULL) delete end_; if (lt_ != NULL) delete lt_; if (gt_ != NULL) delete gt_; if (lte_ != NULL) delete lte_; @@ -588,32 +582,29 @@ struct Iterator { dbIterator_ = database_->NewIterator(options_); - if (start_ != NULL) { - dbIterator_->Seek(*start_); + if (!reverse_ && gte_ != NULL) { + dbIterator_->Seek(*gte_); + } else if (!reverse_ && gt_ != NULL) { + dbIterator_->Seek(*gt_); - if (reverse_) { - if (!dbIterator_->Valid()) { - dbIterator_->SeekToLast(); - } else { - leveldb::Slice key = dbIterator_->key(); - - if ((lt_ != NULL && key.compare(*lt_) >= 0) || - (lte_ != NULL && key.compare(*lte_) > 0) || - (start_ != NULL && key.compare(*start_) > 0)) { - dbIterator_->Prev(); - } - } + if (dbIterator_->Valid() && dbIterator_->key().compare(*gt_) == 0) { + dbIterator_->Next(); + } + } else if (reverse_ && lte_ != NULL) { + dbIterator_->Seek(*lte_); - // TODO: this looks like dead code. Remove it in a - // next major release together with Level/community#86. - if (dbIterator_->Valid() && lt_ != NULL) { - if (dbIterator_->key().compare(*lt_) >= 0) - dbIterator_->Prev(); - } - } else { - if (dbIterator_->Valid() && gt_ != NULL - && dbIterator_->key().compare(*gt_) == 0) - dbIterator_->Next(); + if (!dbIterator_->Valid()) { + dbIterator_->SeekToLast(); + } else if (dbIterator_->key().compare(*lte_) > 0) { + dbIterator_->Prev(); + } + } else if (reverse_ && lt_ != NULL) { + dbIterator_->Seek(*lt_); + + if (!dbIterator_->Valid()) { + dbIterator_->SeekToLast(); + } else if (dbIterator_->key().compare(*lt_) >= 0) { + dbIterator_->Prev(); } } else if (reverse_) { dbIterator_->SeekToLast(); @@ -638,12 +629,8 @@ struct Iterator { if (dbIterator_->Valid()) { std::string keyStr = dbIterator_->key().ToString(); - const int isEnd = end_ == NULL ? 1 : end_->compare(keyStr); if ((limit_ < 0 || ++count_ <= limit_) - && (end_ == NULL - || (reverse_ && (isEnd <= 0)) - || (!reverse_ && (isEnd >= 0))) && ( lt_ != NULL ? (lt_->compare(keyStr) > 0) : lte_ != NULL ? (lte_->compare(keyStr) >= 0) : true ) @@ -665,20 +652,10 @@ struct Iterator { } bool OutOfRange (leveldb::Slice& target) { - if ((lt_ != NULL && target.compare(*lt_) >= 0) || - (lte_ != NULL && target.compare(*lte_) > 0) || - (start_ != NULL && reverse_ && target.compare(*start_) > 0)) { - return true; - } - - if (end_ != NULL) { - int d = target.compare(*end_); - if (reverse_ ? d < 0 : d > 0) return true; - } - - return ((gt_ != NULL && target.compare(*gt_) <= 0) || - (gte_ != NULL && target.compare(*gte_) < 0) || - (start_ != NULL && !reverse_ && target.compare(*start_) < 0)); + return ((lt_ != NULL && target.compare(*lt_) >= 0) || + (lte_ != NULL && target.compare(*lte_) > 0) || + (gt_ != NULL && target.compare(*gt_) <= 0) || + (gte_ != NULL && target.compare(*gte_) < 0)); } bool IteratorNext (std::vector >& result) { @@ -711,8 +688,6 @@ struct Iterator { Database* database_; uint32_t id_; - std::string* start_; - std::string* end_; bool reverse_; bool keys_; bool values_; @@ -1251,21 +1226,13 @@ NAPI_METHOD(iterator_init) { uint32_t highWaterMark = Uint32Property(env, options, "highWaterMark", 16 * 1024); - std::string* start = NULL; - std::string* end = RangeOption(env, options, "end"); std::string* lt = RangeOption(env, options, "lt"); std::string* lte = RangeOption(env, options, "lte"); std::string* gt = RangeOption(env, options, "gt"); std::string* gte = RangeOption(env, options, "gte"); - if (!reverse && gte != NULL) start = new std::string(*gte); - else if (!reverse && gt != NULL) start = new std::string(*gt); - else if (reverse && lte != NULL) start = new std::string(*lte); - else if (reverse && lt != NULL) start = new std::string(*lt); - else start = RangeOption(env, options, "start"); - uint32_t id = database->currentIteratorId_++; - Iterator* iterator = new Iterator(database, id, start, end, reverse, keys, + Iterator* iterator = new Iterator(database, id, reverse, keys, values, limit, lt, lte, gt, gte, fillCache, keyAsBuffer, valueAsBuffer, highWaterMark); napi_value result; diff --git a/package.json b/package.json index 6710f3f2..e83d03cb 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "prebuild-darwin-x64": "prebuildify -t 8.14.0 --napi --strip" }, "dependencies": { - "abstract-leveldown": "^6.3.0", + "abstract-leveldown": "^7.0.0", "napi-macros": "~2.0.0", "node-gyp-build": "~4.2.1" }, diff --git a/test/empty-range-option-test.js b/test/empty-range-option-test.js index 6f6974de..d6a2fdec 100644 --- a/test/empty-range-option-test.js +++ b/test/empty-range-option-test.js @@ -1,7 +1,7 @@ const test = require('tape') const concat = require('level-concat-iterator') const testCommon = require('./common') -const rangeOptions = 'start end gt gte lt lte'.split(' ') +const rangeOptions = ['gt', 'gte', 'lt', 'lte'] test('empty range options are ignored', function (t) { const db = testCommon.factory() diff --git a/test/iterator-recursion-test.js b/test/iterator-recursion-test.js index aa4b96e1..fbdc4293 100644 --- a/test/iterator-recursion-test.js +++ b/test/iterator-recursion-test.js @@ -68,8 +68,10 @@ test('iterate over a large iterator with a large watermark', function (t) { highWaterMark: 10000000 }) const read = function () { - iterator.next(function () { - if (!arguments.length) { + iterator.next(function (err, key, value) { + if (err) throw err + + if (key === undefined && value === undefined) { t.end() } else { read() diff --git a/test/stack-blower.js b/test/stack-blower.js index 24f0a18c..390bcbb5 100644 --- a/test/stack-blower.js +++ b/test/stack-blower.js @@ -13,7 +13,7 @@ if (process.argv[2] === 'run') { db.open(function () { function recurse () { - db.iterator({ start: '0' }) + db.iterator({ gte: '0' }) depth++ recurse() } From cff883a8e0c3aee4ee01d48fd9a1664ca077e889 Mon Sep 17 00:00:00 2001 From: Vincent Weevers Date: Sat, 10 Apr 2021 22:21:30 +0200 Subject: [PATCH 23/25] Update readme and .npmignore --- .npmignore | 2 ++ README.md | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.npmignore b/.npmignore index fa851227..99b0acc3 100644 --- a/.npmignore +++ b/.npmignore @@ -29,6 +29,7 @@ libleveldb.a *.sln *.vcxproj *.vcxproj.filters +.vscode # Benchmarks and tests test/ @@ -39,6 +40,7 @@ test/ .nyc_output/ yarn.lock .gitmodules +.github .travis.yml .cirrus.yml appveyor.yml diff --git a/README.md b/README.md index 72d4f352..5cdef558 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ See the section on safety below for details of known unsaf ## Supported Platforms -We aim to support _at least_ Active LTS and Current Node.js releases, Electron 4.0.0, as well as any future Node.js and Electron releases thanks to [N-API](https://nodejs.org/api/n-api.html). The minimum node version for `leveldown` is `8.6.0`. Conversely, for node >= 12, the minimum `leveldown` version is `5.0.0`. +We aim to support _at least_ Active LTS and Current Node.js releases, Electron 5.0.0, as well as any future Node.js and Electron releases thanks to [N-API](https://nodejs.org/api/n-api.html). The minimum node version for `leveldown` is `10.12.0`. Conversely, for node >= 12, the minimum `leveldown` version is `5.0.0`. The `leveldown` npm package ships with prebuilt binaries for popular 64-bit platforms as well as ARM, Android and Alpine (musl) and is known to work on: @@ -454,7 +454,7 @@ $ git submodule update --init --recursive 3. Wait for Travis and AppVeyor builds to complete 4. Download prebuilds into `./prebuilds`: `npm run download-prebuilds` 5. Optionally verify loading a prebuild: `npm run test-prebuild` -6. Optionally verify which files npm will include: `irish-pub` +6. Optionally verify which files npm will include: `canadian-pub` 7. Add changelog to the GitHub release 8. Finally: `npm publish` From 686d68519c81003c7a854b2018ddbd56a08d89a2 Mon Sep 17 00:00:00 2001 From: Vincent Weevers Date: Sat, 10 Apr 2021 22:28:23 +0200 Subject: [PATCH 24/25] Remove default export (Level/community#87) --- leveldown.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/leveldown.js b/leveldown.js index ad7d0abe..67f993e5 100644 --- a/leveldown.js +++ b/leveldown.js @@ -152,4 +152,4 @@ LevelDOWN.repair = function (location, callback) { binding.repair_db(location, callback) } -module.exports = LevelDOWN.default = LevelDOWN +module.exports = LevelDOWN From 77b5238cc44e6ca6e685c9e930ee1c6b8656caaf Mon Sep 17 00:00:00 2001 From: Vincent Weevers Date: Sat, 10 Apr 2021 23:41:48 +0200 Subject: [PATCH 25/25] 6.0.0 --- CHANGELOG.md | 19 ++++++++++++++++++- README.md | 36 ++++++++++++++++++++++++++++++++++++ UPGRADING.md | 24 ++++++++++++++++++++---- appveyor.yml | 2 +- package.json | 2 +- 5 files changed, 76 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ddd2e548..ee8a1e8e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,21 @@ _**If you are upgrading:** please see [`UPGRADING.md`](UPGRADING.md)._ +## [6.0.0] - 2021-04-10 + +### Changed + +- **Breaking:** bump `abstract-leveldown` ([`15d5a9e`](https://github.com/Level/leveldown/commit/15d5a9e)) (Vincent Weevers) +- **Breaking:** drop node 6 and 8 ([Level/community#98](https://github.com/Level/community/issues/98)) ([`8502b34`](https://github.com/Level/leveldown/commit/8502b34)) (Vincent Weevers) +- Bump `node-gyp` from 6.x to 7.x ([`8bc5696`](https://github.com/Level/leveldown/commit/8bc5696)) (Vincent Weevers) +- Bump `standard` from 14.x to 16.x ([`d39e232`](https://github.com/Level/leveldown/commit/d39e232), [`39e3ca3`](https://github.com/Level/leveldown/commit/39e3ca3)) (Vincent Weevers) +- Bump `node-gyp-build` from 4.1.x to 4.2.x ([#708](https://github.com/Level/leveldown/issues/708)) ([`91711fa`](https://github.com/Level/leveldown/commit/91711fa)) (Vincent Weevers) +- Skip stack exhaustion test ([`55a33b1`](https://github.com/Level/leveldown/commit/55a33b1)) (Vincent Weevers) + +### Removed + +- Remove default export ([Level/community#87](https://github.com/Level/community/issues/87)) ([`686d685`](https://github.com/Level/leveldown/commit/686d685)) (Vincent Weevers) + ## [5.6.0] - 2020-03-27 ### Changed @@ -793,7 +808,7 @@ _**If you are upgrading:** please see [`UPGRADING.md`](UPGRADING.md)._ ### Changed -- Upgrade to `nan@0.6` for Node@0.11.6 support, `v8::Local::New(val)` rewritten to `NanNewLocal(val)` ([**@rvagg**](https://github.com/rvagg)) +- Upgrade to `nan@0.6` for Node 0.11.6 support, `v8::Local::New(val)` rewritten to `NanNewLocal(val)` ([**@rvagg**](https://github.com/rvagg)) **Historical Note** From this release and onward, tags in git start with the prefix `v`, i.e. this release corresponds to the tag `v0.10.1`. @@ -1083,6 +1098,8 @@ _**If you are upgrading:** please see [`UPGRADING.md`](UPGRADING.md)._ :seedling: First release. Extracted from `levelup` as a stand-alone package ([**@rvagg**](https://github.com/rvagg)) +[6.0.0]: https://github.com/Level/leveldown/compare/v5.6.0...v6.0.0 + [5.6.0]: https://github.com/Level/leveldown/compare/v5.5.1...v5.6.0 [5.5.1]: https://github.com/Level/leveldown/compare/v5.5.0...v5.5.1 diff --git a/README.md b/README.md index 5cdef558..7d7521fb 100644 --- a/README.md +++ b/README.md @@ -18,12 +18,48 @@ - [Introduction](#introduction) - [Supported Platforms](#supported-platforms) + - [Notes](#notes) - [API](#api) + - [`db = leveldown(location)`](#db--leveldownlocation) + - [`db.open([options, ]callback)`](#dbopenoptions-callback) + - [`options`](#options) + - [`db.close(callback)`](#dbclosecallback) + - [`db.put(key, value[, options], callback)`](#dbputkey-value-options-callback) + - [`options`](#options-1) + - [`db.get(key[, options], callback)`](#dbgetkey-options-callback) + - [`options`](#options-2) + - [`db.del(key[, options], callback)`](#dbdelkey-options-callback) + - [`options`](#options-3) + - [`db.batch(operations[, options], callback)` _(array form)_](#dbbatchoperations-options-callback-array-form) + - [`db.batch()` _(chained form)_](#dbbatch-chained-form) + - [`db.approximateSize(start, end, callback)`](#dbapproximatesizestart-end-callback) + - [`db.compactRange(start, end, callback)`](#dbcompactrangestart-end-callback) + - [`db.getProperty(property)`](#dbgetpropertyproperty) + - [`db.iterator([options])`](#dbiteratoroptions) + - [`db.clear([options, ]callback)`](#dbclearoptions-callback) + - [`chainedBatch`](#chainedbatch) + - [`chainedBatch.put(key, value)`](#chainedbatchputkey-value) + - [`chainedBatch.del(key)`](#chainedbatchdelkey) + - [`chainedBatch.clear()`](#chainedbatchclear) + - [`chainedBatch.write([options, ]callback)`](#chainedbatchwriteoptions-callback) + - [`chainedBatch.db`](#chainedbatchdb) + - [`iterator`](#iterator) + - [`iterator.next(callback)`](#iteratornextcallback) + - [`iterator.seek(key)`](#iteratorseekkey) + - [`iterator.end(callback)`](#iteratorendcallback) + - [`iterator.db`](#iteratordb) + - [`leveldown.destroy(location, callback)`](#leveldowndestroylocation-callback) + - [`leveldown.repair(location, callback)`](#leveldownrepairlocation-callback) - [Safety](#safety) + - [Database State](#database-state) - [Snapshots](#snapshots) - [Getting Support](#getting-support) - [Contributing](#contributing) + - [Git Submodules](#git-submodules) + - [Publishing](#publishing) - [Donate](#donate) + - [Backers](#backers) + - [Sponsors](#sponsors) - [License](#license) diff --git a/UPGRADING.md b/UPGRADING.md index cce973fb..59abc85c 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -2,7 +2,23 @@ This document describes breaking changes and how to upgrade. For a complete list of changes including minor and patch releases, please refer to the [changelog](CHANGELOG.md). -## v5 +## 6.0.0 + +Legacy range options have been removed ([Level/community#86](https://github.com/Level/community/issues/86)). If you previously did: + +```js +db.iterator({ start: 'a', end: 'z' }) +``` + +An error would now be thrown and you must instead do: + +```js +db.iterator({ gte: 'a', lte: 'z' }) +``` + +This release also drops support of Node.js 6 and 8 ([Level/community#98](https://github.com/Level/community/issues/98)). + +## 5.0.0 This is a rewrite to N-API - which is a huge milestone, achieved without an impact on write performance - and an upgrade to `abstract-leveldown` v6, which solves long-standing issues around serialization and type support. @@ -58,15 +74,15 @@ db.close(function (err) { A future release will do the same for other operations like `get` and `batch`. -## v4 +## 4.0.0 Dropped support for node 4. No other breaking changes. -## v3.0.1 +## 3.0.1 If you're using node v10 you'll need at least `leveldown@2.0.1` to successfully compile. In addition, if you want prebuilt binaries you'll need at least `leveldown@3.0.1`. -## v3 +## 3.0.0 #### `.batch(array)` enforces objects diff --git a/appveyor.yml b/appveyor.yml index 0bccd001..7b26c997 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -35,7 +35,7 @@ deploy: - provider: GitHub artifact: $(ARCHIVE_NAME) auth_token: - secure: AjmYV2zeogfen7F6tXvR9PO1zynJVF/jhMCExQ9RMtqEHDMH8Frclym3GniZkEB0 + secure: Oe6B6Pf/inZ0I5Ta2HVEMg8PAfwi95EtfvTKKMAvFdUPXF//sExugRdATtnMFiwu draft: false on: appveyor_repo_tag: true diff --git a/package.json b/package.json index e83d03cb..74324137 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "leveldown", - "version": "5.6.0", + "version": "6.0.0", "description": "A low-level Node.js LevelDB binding", "license": "MIT", "main": "leveldown.js",