You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
744 B

4 years ago
const util = require('util')
const AbstractChainedBatch = require('abstract-leveldown').AbstractChainedBatch
const binding = require('./binding')
function ChainedBatch (db) {
AbstractChainedBatch.call(this, db)
this.context = binding.batch_init(db.context)
}
ChainedBatch.prototype._put = function (key, value) {
binding.batch_put(this.context, key, value)
}
ChainedBatch.prototype._del = function (key) {
binding.batch_del(this.context, key)
}
ChainedBatch.prototype._clear = function () {
binding.batch_clear(this.context)
}
ChainedBatch.prototype._write = function (options, callback) {
binding.batch_write(this.context, options, callback)
}
util.inherits(ChainedBatch, AbstractChainedBatch)
module.exports = ChainedBatch