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

Function startChanges

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

Source from the content-addressed store, hash-verified

10175 }
10176
10177 function startChanges() {
10178 initCheckpointer().then(function () {
10179 /* istanbul ignore if */
10180 if (returnValue.cancelled) {
10181 completeReplication();
10182 return;
10183 }
10184 return checkpointer.getCheckpoint().then(createTask).then(function (checkpoint) {
10185 last_seq = checkpoint;
10186 initial_last_seq = checkpoint;
10187 changesOpts = {
10188 since: last_seq,
10189 limit: batch_size,
10190 batch_size,
10191 style,
10192 doc_ids,
10193 selector,
10194 return_docs: true // required so we know when we're done
10195 };
10196 if (opts.filter) {
10197 if (typeof opts.filter !== 'string') {
10198 // required for the client-side filter in onChange
10199 changesOpts.include_docs = true;
10200 } else { // ddoc filter
10201 changesOpts.filter = opts.filter;
10202 }
10203 }
10204 if ('heartbeat' in opts) {
10205 changesOpts.heartbeat = opts.heartbeat;
10206 }
10207 if ('timeout' in opts) {
10208 changesOpts.timeout = opts.timeout;
10209 }
10210 if (opts.query_params) {
10211 changesOpts.query_params = opts.query_params;
10212 }
10213 if (opts.view) {
10214 changesOpts.view = opts.view;
10215 }
10216 getChanges();
10217 });
10218 }).catch(function (err) {
10219 abortReplication('getCheckpoint rejected with ', err);
10220 });
10221 }
10222
10223 /* istanbul ignore next */
10224 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…