use async writes.
This commit is contained in:
parent
cb73ab908e
commit
a459d190aa
@ -816,6 +816,10 @@ ChainDB.prototype.cache = function cache(entry) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
ChainDB.prototype.get = function get(height) {
|
ChainDB.prototype.get = function get(height) {
|
||||||
|
return this.getSync(height);
|
||||||
|
};
|
||||||
|
|
||||||
|
ChainDB.prototype.getSync = function getSync(height) {
|
||||||
var data, entry;
|
var data, entry;
|
||||||
|
|
||||||
if (this._cache[height])
|
if (this._cache[height])
|
||||||
@ -889,6 +893,10 @@ ChainDB.prototype.getAsync = function getAsync(height, callback) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
ChainDB.prototype.save = function save(entry) {
|
ChainDB.prototype.save = function save(entry) {
|
||||||
|
return this.saveAsync(entry);
|
||||||
|
};
|
||||||
|
|
||||||
|
ChainDB.prototype.saveSync = function saveSync(entry) {
|
||||||
var self = this;
|
var self = this;
|
||||||
var raw, offset;
|
var raw, offset;
|
||||||
|
|
||||||
@ -902,7 +910,6 @@ ChainDB.prototype.save = function save(entry) {
|
|||||||
return this._write(raw, offset);
|
return this._write(raw, offset);
|
||||||
};
|
};
|
||||||
|
|
||||||
// This causes weird race conditions with size/count/tip.
|
|
||||||
ChainDB.prototype.saveAsync = function saveAsync(entry, callback) {
|
ChainDB.prototype.saveAsync = function saveAsync(entry, callback) {
|
||||||
var self = this;
|
var self = this;
|
||||||
var raw, offset;
|
var raw, offset;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user