diff options
author | Mark Haines <mark.haines@matrix.org> | 2016-03-01 14:49:41 +0000 |
---|---|---|
committer | Mark Haines <mark.haines@matrix.org> | 2016-03-01 14:49:41 +0000 |
commit | 60a0f81c7a2da86bf959227a440e3f7a2b727bb5 (patch) | |
tree | 68a0f9fe80d57f529d2aa2c9f355e935389fd0d6 /synapse/app/homeserver.py | |
parent | Merge pull request #611 from matrix-org/erikj/expiring_cache_size (diff) | |
download | synapse-60a0f81c7a2da86bf959227a440e3f7a2b727bb5.tar.xz |
Add a /replication API for extracting the updates that happened on
synapse This is necessary for replicating the data in synapse to be visible to a separate service because presence and typing notifications aren't stored in a database so won't be visible to another process. This API can be used to either get the raw data by requesting the tables themselves or to just receive notifications for updates by following the streams meta-stream. Returns updates for each table requested a JSON array of arrays with a row for each row in the table. Each table is prefixed by a header row with the: name of the table, current stream_id position for the table, number of rows, number of columns and the names of the columns. This is followed by the rows that have been added to the server since the requester last asked. The API has a timeout and is hooked up to the notifier so that a slave can long poll for updates.
Diffstat (limited to 'synapse/app/homeserver.py')
-rwxr-xr-x | synapse/app/homeserver.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/synapse/app/homeserver.py b/synapse/app/homeserver.py index 2b4be7bdd0..de5ee988f1 100755 --- a/synapse/app/homeserver.py +++ b/synapse/app/homeserver.py @@ -63,6 +63,7 @@ from synapse.config.homeserver import HomeServerConfig from synapse.crypto import context_factory from synapse.util.logcontext import LoggingContext from synapse.metrics.resource import MetricsResource, METRICS_PREFIX +from synapse.replication.resource import ReplicationResource, REPLICATION_PREFIX from synapse.federation.transport.server import TransportLayerServer from synapse import events @@ -169,6 +170,9 @@ class SynapseHomeServer(HomeServer): if name == "metrics" and self.get_config().enable_metrics: resources[METRICS_PREFIX] = MetricsResource(self) + if name == "replication": + resources[REPLICATION_PREFIX] = ReplicationResource(self) + root_resource = create_resource_tree(resources) if tls: reactor.listenSSL( |