(db, callback)
| 4911 | } |
| 4912 | |
| 4913 | execute(db, callback) { |
| 4914 | var keys = new Set(); |
| 4915 | var uniqBatches = []; |
| 4916 | |
| 4917 | // remove duplicates; last one wins |
| 4918 | for (var i = this._batch.length - 1; i >= 0; i--) { |
| 4919 | var operation = this._batch[i]; |
| 4920 | var lookupKey = operation.prefix.prefix()[0] + '\xff' + operation.key; |
| 4921 | if (keys.has(lookupKey)) { |
| 4922 | continue; |
| 4923 | } |
| 4924 | keys.add(lookupKey); |
| 4925 | uniqBatches.push(operation); |
| 4926 | } |
| 4927 | |
| 4928 | db.batch(uniqBatches, callback); |
| 4929 | } |
| 4930 | } |
| 4931 | |
| 4932 | var DOC_STORE = 'document-store'; |
no test coverage detected