MCPcopy Create free account
hub / github.com/FernhillFable/cluster / QueryEmitter

Function QueryEmitter

lib/query-emitter.js:8–37  ·  view source on GitHub ↗
(request, streams, ids, extra)

Source from the content-addressed store, hash-verified

6var ERROR_CODE = ShareDBError.CODES;
7
8function QueryEmitter(request, streams, ids, extra) {
9 this.backend = request.backend;
10 this.agent = request.agent;
11 this.db = request.db;
12 this.index = request.index;
13 this.query = request.query;
14 this.collection = request.collection;
15 this.fields = request.fields;
16 this.options = request.options;
17 this.snapshotProjection = request.snapshotProjection;
18 this.streams = streams;
19 this.ids = ids;
20 this.extra = extra;
21
22 this.skipPoll = this.options.skipPoll || util.doNothing;
23 this.canPollDoc = this.db.canPollDoc(this.collection, this.query);
24 this.pollDebounce =
25 (typeof this.options.pollDebounce === 'number') ? this.options.pollDebounce :
26 (typeof this.db.pollDebounce === 'number') ? this.db.pollDebounce :
27 streams.length > 1 ? 1000 : 0;
28 this.pollInterval =
29 (typeof this.options.pollInterval === 'number') ? this.options.pollInterval :
30 (typeof this.db.pollInterval === 'number') ? this.db.pollInterval :
31 streams.length > 1 ? 1000 : 0;
32
33 this._polling = false;
34 this._pendingPoll = null;
35 this._pollDebounceId = null;
36 this._pollIntervalId = null;
37}
38module.exports = QueryEmitter;
39
40// Start processing events from the stream

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected