|
|
@ -202,6 +202,9 @@ Datastore.prototype._loadDatabase = function (cb) { |
|
|
|
, self = this |
|
|
|
, self = this |
|
|
|
; |
|
|
|
; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// In-memory only datastore
|
|
|
|
|
|
|
|
if (!self.filename) { return callback(); } |
|
|
|
|
|
|
|
|
|
|
|
customUtils.ensureDirectoryExists(path.dirname(self.filename), function (err) { |
|
|
|
customUtils.ensureDirectoryExists(path.dirname(self.filename), function (err) { |
|
|
|
fs.exists(self.filename, function (exists) { |
|
|
|
fs.exists(self.filename, function (exists) { |
|
|
|
if (!exists) { |
|
|
|
if (!exists) { |
|
|
@ -302,6 +305,9 @@ Datastore.prototype.persistNewState = function (newDocs, cb) { |
|
|
|
, callback = cb || function () {} |
|
|
|
, callback = cb || function () {} |
|
|
|
; |
|
|
|
; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// In-memory only datastore
|
|
|
|
|
|
|
|
if (!self.filename) { return callback(); } |
|
|
|
|
|
|
|
|
|
|
|
self.datafileSize += newDocs.length; |
|
|
|
self.datafileSize += newDocs.length; |
|
|
|
|
|
|
|
|
|
|
|
newDocs.forEach(function (doc) { |
|
|
|
newDocs.forEach(function (doc) { |
|
|
@ -519,5 +525,4 @@ Datastore.prototype.remove = function () { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
module.exports = Datastore; |
|
|
|
module.exports = Datastore; |
|
|
|