feat: seperate delta from note storage, improve performance

This commit is contained in:
thecodrr
2020-02-03 23:53:58 +05:00
parent 6d3f3353a8
commit aecfe36fa3
8 changed files with 59 additions and 27 deletions

View File

@@ -11,18 +11,16 @@ export default class Indexer extends Storage {
this.indices = (await this.read(this.type)) || [];
}
async exists(key) {
return this.indices.includes(key);
}
async index(key) {
if (this.indices.length <= 0) {
this.indices = (await this.read(this.type)) || [];
}
this.indices[this.indices.length] = key;
await this.write(this.type, this.indices);
}
async getIndices() {
if (this.indices.length <= 0) {
this.indices = (await this.read(this.type)) || [];
}
return this.indices;
}