Commit Graph

22 Commits

Author SHA1 Message Date
David Glasser
8eca012c32 Minor optimizations to new _IdMaps 2014-01-23 21:28:21 -08:00
David Glasser
9513c42291 Change many "maps from stringified ID" to _IdMap
This greatly reduces the number of places in the code where "stringified
IDs" are passed around.

Specifically, changed these maps into _IdMaps:

 - minimongo
   - the main LocalCollection docs map
   - LocalCollection._savedOriginals
   - unordered query results, in several places:
     - query.results
     - query.results_snapshot
     - return value from _getRawObjects
     - as passed to _diffQueryChanges
 - livedata
   - Connection._serverDocuments[collection]
 - mongo-livedata
   - SynchronousCursor._visitedIds
   - return value from SynchronousCursor.getRawObjects
   - PollingObserveDriver._results (when unordered)
2014-01-16 22:33:24 -08:00
David Glasser
1d3d38d6b1 Refactor observe-from-observe-changes
Specifically, factor out the logic that keeps a cache of the current
cursor contents from the part that calls observe callbacks.

Also:
- move IdMap from mongo-livedata to minimongo
- get rid of references to the 'moved' callback which no longer exists
2013-12-02 19:17:40 -08:00
Andrew Wilcox
54b756782c remove leftover comment 2013-03-26 14:45:35 -07:00
Naomi Seyfer
c911cd9ef4 Greenspan comments on ddp-pre1 diff 2013-02-20 14:52:28 -08:00
Naomi Seyfer
747a6ce20c Following through on allowing you to mix callbacks styles within reason 2013-02-06 16:17:53 -08:00
Naomi Seyfer
dc33617804 Writing prose about code; mostly ordereddict 2013-01-31 14:08:22 -08:00
Naomi Seyfer
39f4b5edc2 Fixing the giant comment in diff.js to be descriptive again 2013-01-31 13:54:14 -08:00
Naomi Seyfer
455fcaa14d clean up the diffing code to be simpler logic 2013-01-31 13:48:39 -08:00
Naomi Seyfer
4b9d41e1a1 Stage one in removing the code for old-style observes
Mostly things are now based in observeChanges.  There are still probably
a few places to remove old observe from.
2013-01-31 13:26:35 -08:00
Naomi Seyfer
3991827a9d Made a version of diffQuery ordered that uses the observeChanges callback structure 2013-01-28 17:23:39 -08:00
Naomi Seyfer
5e400d373b draft of a changes-enabled version of diff.js 2013-01-28 15:25:16 -08:00
Naomi Seyfer
89433b5924 Observe changes implemented on top of observe; light testing 2013-01-18 02:58:22 -05:00
Naomi Seyfer
24c4b0615d Mostly switching over to using EJSON.equals 2013-01-17 15:56:12 -05:00
Naomi Seyfer
be8c94c899 Switch from LocalCollection._deepcopy to EJSON.clone 2013-01-17 15:55:41 -05:00
David Glasser
ab8c03e6f7 Add an internal-only (for now) Cursor._observeUnordered API.
Unordered observations have no moved callback and don't pass indices to the
other callbacks. This is used for the automatic cursor publication (because DDP
collections are not ordered) and for Cursor.count(). Internally, the results of
unordered observations are stored as objects instead of an array. This change
has no publicly observable changes, but should increase performance, especially
server-side (since the _diffQuery that drives DDP subscription updates no longer
needs the full complexity of the ordered move detector).

Also, minor optimization to LocalCollection.Cursor._getRawObjects where the
selector is a single ID that is not in the collection (now O(1) instead of
O(n)).
2012-11-02 12:10:47 -07:00
David Glasser
57c3c2a50d _diffQuery: don't compare docs if there's no changed observer. 2012-10-04 14:05:06 -07:00
David Greenspan
df8567dba3 dedup Mongo cursors 2012-04-03 22:40:36 -07:00
David Greenspan
dc2902dde0 snapshots changes with Geoff (comments) 2012-04-03 22:37:12 -07:00
David Greenspan
4dc8944fb4 deepcopy observer callback arguments, only on client 2012-04-03 22:37:11 -07:00
David Greenspan
bf04fccb72 new query diffing algorithm with fuzz tests 2012-04-03 22:37:11 -07:00
Nick Martin
ee1d25f499 Implement pause/resume in Minimongo. Uses a pessimal diff algorithm. 2012-04-03 22:37:11 -07:00