Commit Graph

257 Commits

Author SHA1 Message Date
David Glasser
4f78080845 Update some recent devel changes to work on ddp-pre1. 2013-01-17 15:56:14 -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
Naomi Seyfer
9fe782ab15 Move EJSON stuff to new ejson package. 2013-01-17 15:51:58 -05:00
Naomi Seyfer
950f1e0213 Preliminary binary-type commit
Note: Files will be moved around as much of the new type-handling stuff gets
mvoved into a new ejson package.

Testing to come
2013-01-17 15:51:58 -05:00
David Glasser
8ae6e71715 Make calling setUserId in a method body an error if the method already called
unblock.

This way, the subscription rerun code doesn't have to worry about SUB messages
being processed in parallel.
2013-01-17 15:51:58 -05:00
David Glasser
751fe0e144 Fixes to runtime universal sub creation and concurrency with re-running subs.
Meteor.publish(null, f) now starts universal subscriptions for all existing
sessions (as well as future sessions). Fixes #583. Care is taken when a session
is re-running its subs.

Re-running subs is now implemented by "deactivating" the _LivedataSubscription
object and re-creating a new one instead of "resetting" it in place. This allows
us to ensure that old publish handlers have no access to the merge
boxes (SessionCollectionViews) because deactivated _LivedataSubscriptions ignore
callbacks. Thus, we can be assured that after deactivating all subscription, the
merge box really cannot be affected by old publishers continuing to run.

Note: if a publish function has not even finished its original handler run (eg,
if running setUserId in parallel to a universal subscription, which runs in a
separate fiber from the message-handling loop), the old publish function *WILL*
continue to run (both before and after this commit). However, with this commit,
any attempt by the old publish function to call publisher methods will be
ignored instead of being perhaps-inconsistently interpreted. If a publisher
really needs to know if it has been stopped before it has finished running the
handler, it can set an onStop callback before it does anything that can yield.
2013-01-17 15:51:58 -05:00
David Glasser
258a64d751 Move _runHandler into _LivedataSubscription. Rename vars to camelcase. 2013-01-17 15:51:58 -05:00
David Glasser
ca0719b22d Concurrency improvements to livedata_server.
- If a subscription is stopped before it has fully started (eg, a universal
  publisher that has yielded, or a destroy()ed session), call the stop callback
  immediately in onStop, so as to not leak resources.

- In _setUserID, don't set _isSending to false until after running the stop
  callbacks for all subs; if a stop callback yielded, CollectionViews could have
  been mutated without sending messages.

- Annotate the collection-diffing code with _noYieldsAllowed.
2013-01-17 15:51:58 -05:00
David Glasser
3de2dbe4d9 Follow-up to d618b94: ignore completing universal subs without error.
Otherwise, _publishCursor has to know if it is publishing a universal sub or
not.
2013-01-17 15:51:58 -05:00
David Glasser
4740d17e1d Fix new merge box for overlapping universal subs.
We were using the subscription ID heavily inside the merge box, but universal
subs don't have one. Use a "subscription handle" instead.
2013-01-17 15:51:57 -05:00
Naomi Seyfer
c99c816331 Fixing up docs, making ObjectID consistent with Node api 2013-01-17 15:51:56 -05:00
Naomi Seyfer
5b4910c965 First draft of docs for types. 2013-01-17 15:49:52 -05:00
Naomi Seyfer
3331e1f7d3 Glasser's comments on my diff
* Lots of small things like whitespace fixes
* change the way adding a custom type works
2013-01-17 15:49:48 -05:00
Naomi Seyfer
e1f15e7c7f Hacked objectid in there, though not ideally 2013-01-17 15:47:27 -05:00
Naomi Seyfer
c305ac8d22 Date now works in session var 2013-01-17 15:47:27 -05:00
Naomi Seyfer
2b7751fa5c Export idParse and idStringify in Meteor 2013-01-17 15:47:25 -05:00
Naomi Seyfer
e831608f86 Moving code around; renamed idToDDP etc to idStringify etc 2013-01-17 15:46:41 -05:00
Naomi Seyfer
76dba0150d Fix tinytest include to use _.isEqual 2013-01-17 15:42:34 -05:00
Naomi Seyfer
701d76fe61 Now switching actual collections over to using ObjectID
Previously, had only switched over the default for minimongo --
so there's lots of stuff that actually didn't work.

With this change, two tests are still failing; I will fix them and
then do some more cleanup tomorrow.
2013-01-17 15:42:33 -05:00
Naomi Seyfer
9e130bb398 Self-reviewing my code makes me want to fix problems 2013-01-17 15:42:05 -05:00
Naomi Seyfer
05d0e200ca Documented what methods custom types should have if they are going to work 2013-01-17 15:41:20 -05:00
Naomi Seyfer
f8fefe7aae Force all keys inside minimongo to be strings
... but preserve other types on the outside of minimongo.
So far passing all current regression tests, but moment of truth
when we switch over to ObjectID yet to come.
2013-01-17 15:39:57 -05:00
Naomi Seyfer
432e8ccd98 ObjectID as a value in DDP 2013-01-17 15:30:25 -05:00
Naomi Seyfer
3b16ca8aa6 Various tests for new data types in DDP:
Test for a document with a date; full stack

Test and fix for method invocation with a Date

Tests for literal
2013-01-17 15:29:51 -05:00
Naomi Seyfer
5454ccbd9f Extended types for DDP
This is a first pass for now; it doesn't support all the types
we will eventually support, and it may be in flux in terms of the exact
format for a little while yet.  Also I need to write tests.

But the outline is there.
2013-01-17 15:29:49 -05:00
Naomi Seyfer
933fe4c6fc Fix new test to work with ddp-pre1 2013-01-17 15:29:07 -05:00
Naomi Seyfer
2f57c23321 Changed new test to deal with new ddp format 2013-01-17 15:29:07 -05:00
Naomi Seyfer
48203263e3 In the client, now all internal "abstract ddp" uses fieldName: undefined
Instead of a cleared list.  The wire format still has a cleared list.
2013-01-17 15:29:05 -05:00
Naomi Seyfer
f2209076e1 In the server, all internal changed messages now have fieldName: undefined
to mean that the field was cleared, instead of a separate clear list.

Wire format will still have separate clear list
Next step is making a similar change on the client.
2013-01-17 15:25:52 -05:00
David Glasser
a709cfb4ec Version negotiation: feedback from review. 2013-01-17 15:25:01 -05:00
David Glasser
a93567eed1 Change removed messages to just take a single ID. 2013-01-17 15:25:01 -05:00
David Glasser
5bf45d1ec6 Version negotiation. 2013-01-17 15:25:01 -05:00
Naomi Seyfer
c2e80dbdac Simplify added code, fix a bug where we were doubling sending _id on the wire 2013-01-17 15:23:24 -05:00
David Glasser
001cbcb337 Fix concurrency issue with yielding runHandler.
All tests now pass.
2013-01-17 15:23:24 -05:00
David Glasser
8f64942dac Should not be in loop. 2013-01-17 15:23:24 -05:00
David Glasser
0e786a41c8 More fixes for DDP rewrite. 'livedata' tests pass. 2013-01-17 15:23:24 -05:00
David Glasser
8b44dc1757 Fix order of arguments. 2013-01-17 15:23:24 -05:00
Naomi Seyfer
e4395720f3 Most of livedata_connection_tests adjusted 2013-01-17 15:23:24 -05:00
Naomi Seyfer
a9104afe5b Attempting to get set userid working 2013-01-17 15:23:24 -05:00
Naomi Seyfer
6873f4acc1 Some self=this adjustments and now basic apps work 2013-01-17 15:23:23 -05:00
Naomi Seyfer
cc2a5d3ffb Client-side changes so ddp-pre1 affects minimongo 2013-01-17 15:23:23 -05:00
David Glasser
070bfc72ba DDP-pre1 sends "method updated" messages as msg=updated, not msg=data. 2013-01-17 15:23:23 -05:00
Naomi Seyfer
ec8b46033a mongo_driver.js modified to use added-changed-removed. Tests do not pass yet 2013-01-17 15:23:23 -05:00
David Glasser
36fe3033cb Fix bug in _SessionDocumentView where objects are not maps.
Generally clean up use of 'in'.
2013-01-17 15:23:23 -05:00
Naomi Seyfer
c915c375c7 First stage of ddp-pre1 plumbing: livedata-server.js 2013-01-17 15:23:23 -05:00
Naomi Seyfer
9c96cf6718 Change added api to have id separately 2013-01-17 15:23:23 -05:00
David Glasser
1f122da21e Fix use of incorrect variable name. 2013-01-17 15:23:23 -05:00
David Glasser
6cc809b956 Avoid unnecessary equality comparison in clearField.
Minor test changes.
2013-01-17 15:23:23 -05:00
Naomi Seyfer
81940c9859 Lots of tests for the merge box 2013-01-17 15:23:23 -05:00