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

Function startChanges

lib/index.js:10211–10255  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

10209 }
10210
10211 function startChanges() {
10212 initCheckpointer().then(function () {
10213 /* istanbul ignore if */
10214 if (returnValue.cancelled) {
10215 completeReplication();
10216 return;
10217 }
10218 return checkpointer.getCheckpoint().then(createTask).then(function (checkpoint) {
10219 last_seq = checkpoint;
10220 initial_last_seq = checkpoint;
10221 changesOpts = {
10222 since: last_seq,
10223 limit: batch_size,
10224 batch_size,
10225 style,
10226 doc_ids,
10227 selector,
10228 return_docs: true // required so we know when we're done
10229 };
10230 if (opts.filter) {
10231 if (typeof opts.filter !== 'string') {
10232 // required for the client-side filter in onChange
10233 changesOpts.include_docs = true;
10234 } else { // ddoc filter
10235 changesOpts.filter = opts.filter;
10236 }
10237 }
10238 if ('heartbeat' in opts) {
10239 changesOpts.heartbeat = opts.heartbeat;
10240 }
10241 if ('timeout' in opts) {
10242 changesOpts.timeout = opts.timeout;
10243 }
10244 if (opts.query_params) {
10245 changesOpts.query_params = opts.query_params;
10246 }
10247 if (opts.view) {
10248 changesOpts.view = opts.view;
10249 }
10250 getChanges();
10251 });
10252 }).catch(function (err) {
10253 abortReplication('getCheckpoint rejected with ', err);
10254 });
10255 }
10256
10257 /* istanbul ignore next */
10258 function onCheckpointError(err) {

Callers 1

replicateFunction · 0.70

Calls 5

initCheckpointerFunction · 0.70
completeReplicationFunction · 0.70
getChangesFunction · 0.70
abortReplicationFunction · 0.70
getCheckpointMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…