Add super simple streaming API endpoint.

Summary:
This commit adds support for a long-polling API changes endpoint at
/n/<namespace_id>/delta/streaming. Soon we can directly stream the same updates
as the old delta sync endpoint, but for the moment we just send a really basic
ping when there are changes detected.

Test Plan: Unit tests added.

Reviewers: bengotow, kav-ya

Reviewed By: kav-ya

Subscribers: spang

Differential Revision: https://review.inboxapp.com/D647
[SCHEMA] Simplify transaction log construction; rework delta sync.

Summary:
Implement a leaner and meaner transaction log:

* Instead of storing an ORM-derived 'delta', only store a snapshot of the API
  representation of the versioned object. We weren't using the delta for
  anything.

* This lets us simplify the rather hairy ORM-history-inspection we were doing
  to figure out whether to create an update revision or not. On versioned
  objects, we just look at column-mapped attributes, and at relationship
  attributes named in the `versioned_relationships` property. If any of these
  have changes, we create a revision.
  (We don't look at all relationship attributes, because you don't
  need to version a Message instance if it gets a new ImapUid, for example.)

* Simplify and consolidate the revision creation code.

* Simplify the construction of delta sync responses.

Fixes T567.

Test Plan: Unit tests added.

Reviewers: spang, kav-ya

Reviewed By: kav-ya

Maniphest Tasks: T567

Differential Revision: https://review.inboxapp.com/D655
Return actual deltas in the streaming API; consolidate code.

Summary:
Instead of sending basically just a ping, `/delta/streaming` now returns actual
change responses, in the same format as the existing `/delta` endpoint.

Concretely, this means that response chunks look something like this (formatted
for clarity):
```
{
    "cursor": "4ya4oyxo7rurxamyt9brfju5b",
    "object": "thread",
    "event": "update",
    "id": "71ormxuivtg52p141tpgjk3vi",
    "attributes": {
        "namespace_id": "f3b0j663wmm2bluq77uc4db9m",
        "tags": [{"name": "drafts", "id": "drafts"},
                 {"name": "starred", "id": "starred"}],
        "last_message_timestamp": 1414778436,
        "object": "thread",
        "message_ids": [],
        "snippet": "",
        "participants": [],
        "draft_ids": ["diu1tytx7p9wnx64hdbxsypqe"],
        "first_message_timestamp": 1414778436,
        "id": "71ormxuivtg52p141tpgjk3vi",
        "subject": "Hello World!"
    }
}
```
The "cursor" value can be used to fetch subsequent changes if the client is
disconnected. As a client, you can keep track of the cursor for the latest
event you've processed, and query
`/n/<namespace_id>/delta/streaming?cursor=<cursor>` to get all changes starting
from that point and onwards.

To this end, consolidate logic for the `/delta` and `/delta/streaming`
endpoints, and update docstrings, etc.

Test Plan: Unit tests added/updated.

Reviewers: spang, kav-ya

Reviewed By: kav-ya

Differential Revision: https://review.inboxapp.com/D667
Basic syncback for google calendars

Summary:
This is a basic implementation of syncback. I did two things:
- adapted the syncback code to handle additional actions. I copied the structure of the IMAP syncback code: there's a inbox.events.actions which mirrors inbox.actions, with a backend/ subfolder.
- wrote a syncback module for gmail. So far, it only supports saving to the primary calendar.

Test Plan: Tested manually.

Reviewers: kav-ya, emfree

Reviewed By: emfree

Subscribers: spang

Projects: #sync-engine

Differential Revision: https://review.inboxapp.com/D679
Remove unnecessary imports from util/rdb.py.

Summary: Fixes T592.

Test Plan: Run unit test suite.

Reviewers: khamidou

Maniphest Tasks: T592

Differential Revision: https://review.inboxapp.com/D697

Conflicts:
	inbox/util/rdb.py
Ensure syncs are restarted if necessary after reauth.

Summary:
This is a bit of a stopgap fix for the problem of syncs not being automatically
restarted if they were previously stopped because of invalid credentials, but
the user actually reauths.

Test Plan:
Set test account state to invalid; check that sync gets restarted
after reauth.

Reviewers: kav-ya

Differential Revision: https://review.inboxapp.com/D701
Reject sending to an empty list of recipients.

Previously we'd just reject your post body if you didn't include the recipients
field at all.

Fixes T589.