-
-
Notifications
You must be signed in to change notification settings - Fork 177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Napi rewrite #540
Napi rewrite #540
Changes from all commits
11797d8
71e7823
9f03290
1fba29c
e37cda0
085ef08
3ede7b3
20f2aea
6889722
182a58b
043508a
57b0be4
5613fb5
2acd4b6
8de6618
6f09aaf
f7c6d93
64ff8f6
52ccc82
79966af
60b7982
8aba0c3
023deae
fc46554
0790470
ad079a5
a1f94da
ce049dd
50062ad
1dfe434
02cceda
cb15d6e
d6001e1
8855749
6aca8c8
cb34bf0
41c19a2
4bcffea
647c3dd
42da176
d4dd7f0
e80be43
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = require('node-gyp-build')(__dirname) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,32 @@ | ||
const util = require('util') | ||
const AbstractChainedBatch = require('abstract-leveldown').AbstractChainedBatch | ||
const binding = require('./binding') | ||
|
||
function ChainedBatch (db) { | ||
AbstractChainedBatch.call(this, db) | ||
this.binding = db.binding.batch() | ||
this.context = binding.batch_init(db.context) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here's how we do it, regardless of where we are. We use an |
||
} | ||
|
||
ChainedBatch.prototype._put = function (key, value) { | ||
this.binding.put(key, value) | ||
binding.batch_put(this.context, key, value) | ||
} | ||
|
||
ChainedBatch.prototype._del = function (key) { | ||
this.binding.del(key) | ||
binding.batch_del(this.context, key) | ||
} | ||
|
||
ChainedBatch.prototype._clear = function () { | ||
this.binding.clear() | ||
binding.batch_clear(this.context) | ||
} | ||
|
||
ChainedBatch.prototype._write = function (options, callback) { | ||
this.binding.write(callback) | ||
// TODO (ensure docs covers the following) | ||
// Note that we're passing in options here, which we didn't do before. We | ||
// must do this so we can use the `sync` property, which we didn't handle before | ||
// since we never passed in an object at time of creation (bug) (the previous c++ | ||
// used to assume we did this from the js side from the ChainedBatch() | ||
// constructor). | ||
binding.batch_write(this.context, options, callback) | ||
vweevers marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
util.inherits(ChainedBatch, AbstractChainedBatch) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,8 @@ | |
"abstract-leveldown": "~6.0.0", | ||
"bindings": "~1.3.0", | ||
"fast-future": "~1.0.2", | ||
"nan": "~2.11.0", | ||
"napi-macros": "^1.8.1", | ||
"node-gyp-build": "^3.5.1", | ||
"prebuild-install": "^5.0.0" | ||
}, | ||
"devDependencies": { | ||
|
@@ -43,7 +44,7 @@ | |
"verify-travis-appveyor": "^3.0.0" | ||
}, | ||
"scripts": { | ||
"install": "prebuild-install || node-gyp rebuild", | ||
vweevers marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"install": "node-gyp-build", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
"test": "standard && verify-travis-appveyor && nyc tape test/*-test.js && prebuild-ci", | ||
"coverage": "nyc report --reporter=text-lcov | coveralls", | ||
"rebuild": "prebuild --compile", | ||
|
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️ @mafintosh