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

Function startChanges

lib/index.es.js:10206–10250  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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