MCPcopy Index your code
hub / github.com/apache/pouchdb / fetchExistingDocs

Function fetchExistingDocs

lib/index-browser.js:5027–5059  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

5025 }
5026
5027 function fetchExistingDocs() {
5028
5029 if (!docInfos.length) {
5030 return;
5031 }
5032
5033 var numFetched = 0;
5034
5035 function checkDone() {
5036 if (++numFetched === docInfos.length) {
5037 idbProcessDocs();
5038 }
5039 }
5040
5041 function readMetadata(event) {
5042 var metadata = decodeMetadata(event.target.result);
5043
5044 if (metadata) {
5045 fetchedDocs.set(metadata.id, metadata);
5046 }
5047 checkDone();
5048 }
5049
5050 for (var i = 0, len = docInfos.length; i < len; i++) {
5051 var docInfo = docInfos[i];
5052 if (docInfo._id && isLocalId(docInfo._id)) {
5053 checkDone(); // skip local docs
5054 continue;
5055 }
5056 var req = docStore.get(docInfo.metadata.id);
5057 req.onsuccess = readMetadata;
5058 }
5059 }
5060
5061 function complete() {
5062 if (preconditionErrored) {

Callers 1

startTransactionFunction · 0.70

Calls 3

isLocalIdFunction · 0.70
checkDoneFunction · 0.70
getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…