MCPcopy
hub / github.com/apache/pouchdb / fetchWinningDocAndMetadata

Function fetchWinningDocAndMetadata

lib/index-browser.js:5809–5824  ·  view source on GitHub ↗
(doc, seq, cb)

Source from the content-addressed store, hash-verified

5807 }
5808
5809 function fetchWinningDocAndMetadata(doc, seq, cb) {
5810 if (docIds && !docIds.has(doc._id)) {
5811 return cb();
5812 }
5813
5814 var metadata = docIdsToMetadata.get(doc._id);
5815 if (metadata) { // cached
5816 return onGetMetadata(doc, seq, metadata, cb);
5817 }
5818 // metadata not cached, have to go fetch it
5819 docStore.get(doc._id).onsuccess = function (e) {
5820 metadata = decodeMetadata(e.target.result);
5821 docIdsToMetadata.set(doc._id, metadata);
5822 onGetMetadata(doc, seq, metadata, cb);
5823 };
5824 }
5825
5826 function finish() {
5827 opts.complete(null, {

Callers 1

onBatchFunction · 0.70

Calls 3

onGetMetadataFunction · 0.70
decodeMetadataFunction · 0.70
getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…