rename functions.
This commit is contained in:
parent
95ff41dde9
commit
18f1412ba7
@ -824,7 +824,7 @@ ChainDB.prototype.save = function save(entry) {
|
|||||||
raw = entry.toRaw();
|
raw = entry.toRaw();
|
||||||
offset = entry.height * BLOCK_SIZE;
|
offset = entry.height * BLOCK_SIZE;
|
||||||
|
|
||||||
return this._writeSync(raw, offset);
|
return this._write(raw, offset);
|
||||||
};
|
};
|
||||||
|
|
||||||
// This causes weird race conditions with size/count/tip.
|
// This causes weird race conditions with size/count/tip.
|
||||||
@ -853,7 +853,7 @@ ChainDB.prototype.saveAsync = function save(entry, callback) {
|
|||||||
raw = entry.toRaw();
|
raw = entry.toRaw();
|
||||||
offset = entry.height * BLOCK_SIZE;
|
offset = entry.height * BLOCK_SIZE;
|
||||||
|
|
||||||
return this._write(raw, offset, function(err, success) {
|
return this._writeAsync(raw, offset, function(err, success) {
|
||||||
var item = self._queue[entry.height];
|
var item = self._queue[entry.height];
|
||||||
|
|
||||||
assert(item);
|
assert(item);
|
||||||
@ -862,7 +862,7 @@ ChainDB.prototype.saveAsync = function save(entry, callback) {
|
|||||||
// Synchronously write it and get it over with.
|
// Synchronously write it and get it over with.
|
||||||
try {
|
try {
|
||||||
if (item !== entry)
|
if (item !== entry)
|
||||||
success = self._writeSync(item.toRaw(), offset);
|
success = self._write(item.toRaw(), offset);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
err = e;
|
err = e;
|
||||||
}
|
}
|
||||||
@ -885,7 +885,7 @@ ChainDB.prototype.saveAsync = function save(entry, callback) {
|
|||||||
ChainDB.prototype.del = function del(height) {
|
ChainDB.prototype.del = function del(height) {
|
||||||
assert(height >= 0);
|
assert(height >= 0);
|
||||||
|
|
||||||
this._writeSync(this._nullBlock, height * BLOCK_SIZE);
|
this._write(this._nullBlock, height * BLOCK_SIZE);
|
||||||
|
|
||||||
// If we deleted several blocks at the end, go back
|
// If we deleted several blocks at the end, go back
|
||||||
// to the last non-null block and truncate the file
|
// to the last non-null block and truncate the file
|
||||||
@ -929,7 +929,7 @@ ChainDB.prototype._read = function _read(size, offset) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
ChainDB.prototype._write = function _write(data, offset, callback) {
|
ChainDB.prototype._writeAsync = function _writeAsync(data, offset, callback) {
|
||||||
var self = this;
|
var self = this;
|
||||||
var size = data.length;
|
var size = data.length;
|
||||||
var index = 0;
|
var index = 0;
|
||||||
@ -956,7 +956,7 @@ ChainDB.prototype._write = function _write(data, offset, callback) {
|
|||||||
})();
|
})();
|
||||||
};
|
};
|
||||||
|
|
||||||
ChainDB.prototype._writeSync = function _writeSync(data, offset) {
|
ChainDB.prototype._write = function _write(data, offset) {
|
||||||
var size = data.length;
|
var size = data.length;
|
||||||
var index = 0;
|
var index = 0;
|
||||||
var bytes;
|
var bytes;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user