(docInfo, winningRev$$1, winningRevIsDeleted,
isUpdate, resultsIdx, callback)
| 5205 | } |
| 5206 | |
| 5207 | function writeAttachments(docInfo, winningRev$$1, winningRevIsDeleted, |
| 5208 | isUpdate, resultsIdx, callback) { |
| 5209 | |
| 5210 | |
| 5211 | var doc = docInfo.data; |
| 5212 | |
| 5213 | var numDone = 0; |
| 5214 | var attachments = Object.keys(doc._attachments); |
| 5215 | |
| 5216 | function collectResults() { |
| 5217 | if (numDone === attachments.length) { |
| 5218 | finishDoc(docInfo, winningRev$$1, winningRevIsDeleted, |
| 5219 | isUpdate, resultsIdx, callback); |
| 5220 | } |
| 5221 | } |
| 5222 | |
| 5223 | function attachmentSaved() { |
| 5224 | numDone++; |
| 5225 | collectResults(); |
| 5226 | } |
| 5227 | |
| 5228 | attachments.forEach(function (key) { |
| 5229 | var att = docInfo.data._attachments[key]; |
| 5230 | if (!att.stub) { |
| 5231 | var data = att.data; |
| 5232 | delete att.data; |
| 5233 | att.revpos = parseInt(winningRev$$1, 10); |
| 5234 | var digest = att.digest; |
| 5235 | saveAttachment(digest, data, attachmentSaved); |
| 5236 | } else { |
| 5237 | numDone++; |
| 5238 | collectResults(); |
| 5239 | } |
| 5240 | }); |
| 5241 | } |
| 5242 | |
| 5243 | // map seqs to attachment digests, which |
| 5244 | // we will need later during compaction |
no test coverage detected
searching dependent graphs…