Filesystem: Temporarily cache inode data until storage is chunked properly

This commit is contained in:
Fabian 2018-10-15 12:04:14 -03:00
commit eb93fa5db7

View file

@ -1089,7 +1089,13 @@ FS.prototype.get_data = async function(idx) // jshint ignore:line
dbg_assert(inode, `Filesystem get_data: idx ${idx} does not point to an inode`);
if(this.inodedata[idx]) return this.inodedata[idx];
if(inode.sha256sum && this.storage) return await this.storage.get(inode.sha256sum); // jshint ignore:line
if(inode.sha256sum && this.storage)
{
const data = await this.storage.get(inode.sha256sum); // jshint ignore:line
// XXX: Temporary cache until storage can properly chunk
this.inodedata[idx] = data;
return data;
}
return null;
}; // jshint ignore:line