Merge pull request #489 from matrix-org/markjh/replication

Add a /replication API for extracting the updates that happened on synapse.
This commit is contained in:
Mark Haines 2016-03-01 15:08:24 +00:00
commit a612ce6659
15 changed files with 846 additions and 4 deletions

View file

@ -115,6 +115,22 @@ class PresenceStore(SQLBaseStore):
args
)
def get_all_presence_updates(self, last_id, current_id):
def get_all_presence_updates_txn(txn):
sql = (
"SELECT stream_id, user_id, state, last_active_ts,"
" last_federation_update_ts, last_user_sync_ts, status_msg,"
" currently_active"
" FROM presence_stream"
" WHERE ? < stream_id AND stream_id <= ?"
)
txn.execute(sql, (last_id, current_id))
return txn.fetchall()
return self.runInteraction(
"get_all_presence_updates", get_all_presence_updates_txn
)
@defer.inlineCallbacks
def get_presence_for_users(self, user_ids):
rows = yield self._simple_select_many_batch(