Commit graph

17 commits

Author SHA1 Message Date
Erik Johnston f42f44391f
Fix /sync when we have no events (#341)
* Fix /sync when we have no events

We used a since token of 0 to mean that no token was given. However, naffka
streams start at 0. This causes clients to get stuck spinning forever until an
event is sent.

This changes it so that we pass around pointers instead, with nil meaning a
since token wasn't given.

* Comment

* Fix unit tests

* Comments

* Fix typo
2017-11-22 09:51:12 +00:00
Erik Johnston 7f85422471
Move /state request handling out of RequestPool (#333)
We should probably move the handling out from the syncapi, but that
requires the clientapi to stream the current state which it currently
doesn't. This at least stops the sync and state handling being done in
one file.
2017-11-15 15:42:39 +00:00
Erik Johnston 49c040c89f Refactor Notifier to return channel (#311)
This has two benefits:

1. Using channels makes it easier to time out while waiting
2. Allows us to clean up goroutines that were waiting if we timeout the
   request
2017-10-26 11:34:54 +01:00
Erik Johnston bd07447abe Fix some edge cases with /sync (#302)
Including:
- Handle timeout=0 correctly
- Always return immediately on initial sync
- Handle spurious wake ups from the notifier
2017-10-16 13:34:08 +01:00
Erik Johnston 464fb5de1c Update vendor libraries and dendrite to s/Sirupsen/sirupsen/ (#304) 2017-10-13 14:42:57 +01:00
Erik Johnston f36269d9b1 Implement GET /rooms/{roomID}/state/{type}/{stateKey} (#276)
* Implement GET /rooms/{roomID}/state/{type}/{stateKey}

* Add comments
2017-10-06 11:23:58 +01:00
Brendan Abolivier 0218063339 Implement room state retrieval endpoint (#254)
* Move prev event structure to component-wide types

* Renamed key for better understandability

* Implement /state endpoint

* Change rowsToEvents() to return an empty slice instead of nil in case of empty result set

* Doc

* Fix forgotten comma

* Specify HTTP method

* Update comment

* Remove debug fmt.Println
2017-09-22 11:34:54 +01:00
Mark Haines 856bc5b52e Add context to the syncapi database (#234) 2017-09-18 16:52:22 +01:00
Mark Haines e28ee27605 Add context to the account database (#232) 2017-09-18 14:15:27 +01:00
Brendan Abolivier 0fbb8b7824 Make account data sync incremental (#170)
* Clean roomserver consumer

* Make account data sync incremental

* Use a different name for the sync AD table

* Improved error logging

* Created missing topic in tests

* Add client API topic to tests

* Add client API topic to common

* Move data batch retrieval

* Add database index for data retrieval

* Fix typo in table name

* Fix indentation
2017-08-02 16:21:35 +01:00
Brendan Abolivier 3e394e9e21 Save and retrieve account data (#166)
* Save function for account data

* Fix upsert + add empty routes and function

* Save account data

* Retrieval functions

* Implement retrieval in /sync

* Fix arrays not correctly initialised

* Merge account data retrieval functions

* Request DB only once per request

* Initialise array

* Fix comment
2017-07-26 14:53:11 +01:00
Kegsay 3b9222e8f7 Glue together devices and auth with the current HTTP code (#117)
- Renamed `clientapi/auth/types` to `clientapi/auth/authtypes` for the same
  horrible namespace clashing reasons as `storage`.
- Factored out `makeAPI` to `common`.
- Added in `makeAuthAPI`.
2017-05-23 17:43:05 +01:00
Kegsay 94e1c62745 Remove intermediary /sync response struct (#102)
The logic required to populate the right bits of `RoomData` tends towards
the complete `/sync` response struct, so just use the actual response struct
and save the hassle of mapping between the two. It may not make much difference
in its current form, but the next PR will make use of this.

This PR has no functional changes.
2017-05-15 15:18:08 +01:00
Kegsay cc7117392f Send the entire room state down when transitioning to 'join' on a /sync response (#100)
This is only 'mostly' correct currently, because what should be no-op dupe
joins will actually trigger the entire room state to be re-sent.

Bizarrely, it's significantly easier to just do that than work out if we should,
and there are no client-visible effects to doing so, so we just do it for now.
2017-05-12 16:56:17 +01:00
Kegsay 04f3c154b8 Split out notifying /sync requests and calculating sync responses (#96)
* Split out notifying /sync requests and calculating sync responses

The logic for notifying /sync requests is about to get really
complicated as we optimise when to wake up requests, so split
out that code into a separate struct to isolate it and make
it easier to unit test.
2017-05-10 10:42:00 +01:00
Robert Swain d09a65abbe Add Apache Version 2.0 license and headers to all golang files 2017-04-21 00:40:52 +02:00
Robert Swain e281fc4530 syncserver: Rename to syncapi 2017-04-20 19:21:15 +02:00
Renamed from src/github.com/matrix-org/dendrite/syncserver/sync/requestpool.go (Browse further)