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