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

Function doMigrationTwo

lib/index.es.js:6481–6594  ·  view source on GitHub ↗
(db, stores, callback)

Source from the content-addressed store, hash-verified

6479 });
6480};
6481var doMigrationTwo = function (db, stores, callback) {
6482 var batches = [];
6483 stores.bySeqStore.get(UUID_KEY$1, function (err, value) {
6484 if (err) {
6485 // no uuid key, so don't need to migrate;
6486 return callback();
6487 }
6488 batches.push({
6489 key: UUID_KEY$1,
6490 value,
6491 prefix: stores.metaStore,
6492 type: 'put',
6493 valueEncoding: 'json'
6494 });
6495 batches.push({
6496 key: UUID_KEY$1,
6497 prefix: stores.bySeqStore,
6498 type: 'del'
6499 });
6500 stores.bySeqStore.get(DOC_COUNT_KEY$1, function (err, value) {
6501 if (value) {
6502 // if no doc count key,
6503 // just skip
6504 // we can live with this
6505 batches.push({
6506 key: DOC_COUNT_KEY$1,
6507 value,
6508 prefix: stores.metaStore,
6509 type: 'put',
6510 valueEncoding: 'json'
6511 });
6512 batches.push({
6513 key: DOC_COUNT_KEY$1,
6514 prefix: stores.bySeqStore,
6515 type: 'del'
6516 });
6517 }
6518 stores.bySeqStore.get(UPDATE_SEQ_KEY$1, function (err, value) {
6519 if (value) {
6520 // if no UPDATE_SEQ_KEY
6521 // just skip
6522 // we've gone to far to stop.
6523 batches.push({
6524 key: UPDATE_SEQ_KEY$1,
6525 value,
6526 prefix: stores.metaStore,
6527 type: 'put',
6528 valueEncoding: 'json'
6529 });
6530 batches.push({
6531 key: UPDATE_SEQ_KEY$1,
6532 prefix: stores.bySeqStore,
6533 type: 'del'
6534 });
6535 }
6536 var deletedSeqs = {};
6537 stores.docStore.createReadStream({
6538 startKey: '_',

Callers

nothing calls this directly

Calls 6

isLocalIdFunction · 0.70
nextFunction · 0.70
winningRevFunction · 0.70
formatSeqFunction · 0.70
getMethod · 0.45
batchMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…