diff options
author | Erik Johnston <erik@matrix.org> | 2017-03-27 15:40:37 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2017-03-30 12:54:46 +0100 |
commit | 74506934356dcb10b1704e3e66d4648e99ba6308 (patch) | |
tree | 7d61845560b3ab0ee7c4366308c7f30b382699cf /synapse/replication/tcp/__init__.py | |
parent | Define the various streams we will replicate (diff) | |
download | synapse-74506934356dcb10b1704e3e66d4648e99ba6308.tar.xz |
Initial TCP protocol implementation
This defines the low level TCP replication protocol
Diffstat (limited to 'synapse/replication/tcp/__init__.py')
-rw-r--r-- | synapse/replication/tcp/__init__.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/synapse/replication/tcp/__init__.py b/synapse/replication/tcp/__init__.py index 451dae3b6c..8b4e886d4e 100644 --- a/synapse/replication/tcp/__init__.py +++ b/synapse/replication/tcp/__init__.py @@ -12,3 +12,35 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. + +"""This module implements the TCP replication protocol used by synapse to +communicate between the master process and its workers (when they're enabled). + +The protocol is based on fire and forget, line based commands. An example flow +would be (where '>' indicates master->worker and '<' worker->master flows):: + + > SERVER example.com + < REPLICATE events 53 + > RDATA events 54 ["$foo1:bar.com", ...] + > RDATA events 55 ["$foo4:bar.com", ...] + +The example shows the server accepting a new connection and sending its identity +with the `SERVER` command, followed by the client asking to subscribe to the +`events` stream from the token `53`. The server then periodically sends `RDATA` +commands which have the format `RDATA <stream_name> <token> <row>`, where the +format of `<row>` is defined by the individual streams. + +Error reporting happens by either the client or server sending an `ERROR` +command, and usually the connection will be closed. + + +Structure of the module: + * client.py - the client classes used for workers to connect to master + * command.py - the definitions of all the valid commands + * protocol.py - contains bot the client and server protocol implementations, + these should not be used directly + * resource.py - the server classes that accepts and handle client connections + * streams.py - the definitons of all the valid streams + +Further details can be found in docs/tcp_replication.rst +""" |