Commit Graph

2388 Commits

Author SHA1 Message Date
Naomi Seyfer
9506846da7 Switching cursor publishing to observeChanges 2013-01-22 11:53:27 -08:00
Naomi Seyfer
378e7c9fe5 Changes to observeChanges tests now actually work right 2013-01-22 11:05:52 -08:00
Naomi Seyfer
65bec10df5 Moving and rehashing tests for observeChanges.
Now that the tests exist on both client and server, they want to be
able to be asynchronous.  Sadly, the current idiom to do this is
somewhat lacking, so I kind of wrote another prototype idiom.

In this world, we use a callback expecter that has been woven in
to a fiber.  Calling a callback, or timeouts, can wake up the fiber
and make it check if it is time to expect a thing.
2013-01-21 22:59:16 -08:00
Naomi Seyfer
89433b5924 Observe changes implemented on top of observe; light testing 2013-01-18 02:58:22 -05:00
David Glasser
f3d5ba81e7 Cleanup after a grand surgery that removed exploratory changes to minimongo from ddp-pre1.
(The exploratory work is captured on ddp-pre1-exploratory-minimongo-observe.)
2013-01-17 16:27:51 -05:00
David Glasser
86e4f9b00f EJSON: fix error in recursive EJSON.equals with keyOrderSensitive. removed-minimongo-changes 2013-01-17 15:56:14 -05:00
David Glasser
4f78080845 Update some recent devel changes to work on ddp-pre1. 2013-01-17 15:56:14 -05:00
Naomi Seyfer
deb06b627e Workshopping docs for EJSON and ObjectID w/ nim 2013-01-17 15:56:13 -05:00
Naomi Seyfer
20145a7f42 Docs for EJSON package 2013-01-17 15:56:13 -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
David Glasser
7a75b8418a ObjectID detection: Use existence of Meteor.Collection, not isClient. 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
3068fd1a36 ObjectID collections now an option not the default 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
5d93d60aa6 All tests now pass after switching the defualt Collection to ObjectID
**Caveats:**
 - I have not written any more tests; I perhaps should
 - I have not yet written any code to keep current Collections from mixing
   strings and ObjectIDs
 - I don't actually know if the default should be ObjectID.  I should discuss
    with people about this.
2013-01-17 15:41:18 -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
33e0a52c5c ObjectId conversion to/from DDP ids 2013-01-17 15:30:24 -05:00
Naomi Seyfer
1de0a87b84 Client-side ObjectId object 2013-01-17 15:29:51 -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
Naomi Seyfer
91b1f3b15c Workshopping words on the publish docs 2013-01-17 15:25:01 -05:00
David Glasser
5bf45d1ec6 Version negotiation. 2013-01-17 15:25:01 -05:00
Naomi Seyfer
daa559366c Modified docs to reflect ddp-pre1 and new publish handler api 2013-01-17 15:24:28 -05:00
Naomi Seyfer
677a43fe19 Updated python DDP client to ddp-pre1 2013-01-17 15:23:24 -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