summary refs log tree commit diff
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2020-04-30 17:58:18 +0100
committerErik Johnston <erik@matrix.org>2020-05-14 17:25:09 +0100
commit96b6023e3bfc4b6233a038fe38f0c9802f131b69 (patch)
treea555672b3a2f0c98ffd72df704b34c18693060a1
parentAllow ReplicationRestResource to be added to workers (diff)
downloadsynapse-96b6023e3bfc4b6233a038fe38f0c9802f131b69.tar.xz
Make location of events writer configurable
-rw-r--r--synapse/config/workers.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/synapse/config/workers.py b/synapse/config/workers.py
index c80c338584..a4cd4d3066 100644
--- a/synapse/config/workers.py
+++ b/synapse/config/workers.py
@@ -27,6 +27,17 @@ class InstanceLocationConfig:
     port = attr.ib(type=int)
 
 
+@attr.s
+class WriterLocations:
+    """Specifies the instances that write various streams.
+
+    Attributes:
+        events: The instance that writes to the event and backfill streams.
+    """
+
+    events = attr.ib(default="master", type=str)
+
+
 class WorkerConfig(Config):
     """The workers are processes run separately to the main synapse process.
     They have their own pid_file and listener configuration. They use the
@@ -88,6 +99,10 @@ class WorkerConfig(Config):
             name: InstanceLocationConfig(**c) for name, c in instance_map.items()
         }
 
+        # Map from type of streams to source, c.f. WriterLocations.
+        writers = config.get("writers", {}) or {}
+        self.writers = WriterLocations(**writers)
+
     def read_arguments(self, args):
         # We support a bunch of command line arguments that override options in
         # the config. A lot of these options have a worker_* prefix when running