bst: batch op.
This commit is contained in:
parent
135fca806c
commit
09e5d93a15
@ -610,7 +610,7 @@ function Batch(tree, options) {
|
|||||||
|
|
||||||
Batch.prototype.put = function(key, value) {
|
Batch.prototype.put = function(key, value) {
|
||||||
assert(this.tree, 'Already written.');
|
assert(this.tree, 'Already written.');
|
||||||
this.ops.push({ type: 'put', key: key, value: value });
|
this.ops.push(new BatchOp('put', key, value));
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -621,7 +621,7 @@ Batch.prototype.put = function(key, value) {
|
|||||||
|
|
||||||
Batch.prototype.del = function del(key) {
|
Batch.prototype.del = function del(key) {
|
||||||
assert(this.tree, 'Already written.');
|
assert(this.tree, 'Already written.');
|
||||||
this.ops.push({ type: 'del', key: key });
|
this.ops.push(new BatchOp('del', key));
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -666,6 +666,21 @@ Batch.prototype.clear = function clear() {
|
|||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Batch Operation
|
||||||
|
* @constructor
|
||||||
|
* @private
|
||||||
|
* @param {String} type
|
||||||
|
* @param {Buffer} key
|
||||||
|
* @param {Buffer|null} value
|
||||||
|
*/
|
||||||
|
|
||||||
|
function BatchOp(type, key, value) {
|
||||||
|
this.type = type;
|
||||||
|
this.key = key;
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Iterator
|
* Iterator
|
||||||
* @constructor
|
* @constructor
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user