Skip to content

Commit e796281

Browse files
authored
Inline secondary index updates in write
1 parent 58f64f9 commit e796281

1 file changed

Lines changed: 5 additions & 11 deletions

File tree

src/Storage/WritableStorage.js

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -363,16 +363,6 @@ class WritableStorage extends ReadableStorage {
363363
return super.getPartition(partitionIdentifier);
364364
}
365365

366-
addToSecondaryIndexes(indexEntry, document) {
367-
this.forEachSecondaryIndex((index, name) => {
368-
if (!index.isOpen()) {
369-
index.open();
370-
}
371-
index.add(indexEntry);
372-
this.emit('index-add', name, index.length, document);
373-
}, document);
374-
}
375-
376366
/**
377367
* @api
378368
* @param {object} document The document to write to storage.
@@ -392,7 +382,11 @@ class WritableStorage extends ReadableStorage {
392382
assert(position !== false, 'Error writing document.');
393383

394384
const indexEntry = this.addIndex(partition.id, position, dataSize, document);
395-
this.addToSecondaryIndexes(indexEntry, document);
385+
this.forEachSecondaryIndex((index, name) => {
386+
index.open();
387+
index.add(indexEntry);
388+
this.emit('index-add', name, index.length, document);
389+
}, document);
396390

397391
return this.index.length;
398392
}

0 commit comments

Comments
 (0)