1# Copyright 2017 Vector Creations Ltd
2# Copyright 2019 New Vector Ltd
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#     http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16"""Defines all the valid streams that clients can subscribe to, and the format
17of the rows returned by each stream.
18
19Each stream is defined by the following information:
20
21    stream name:        The name of the stream
22    row type:           The type that is used to serialise/deserialse the row
23    current_token:      The function that returns the current token for the stream
24    update_function:    The function that returns a list of updates between two tokens
25"""
26
27from synapse.replication.tcp.streams._base import (
28    AccountDataStream,
29    BackfillStream,
30    CachesStream,
31    DeviceListsStream,
32    GroupServerStream,
33    PresenceFederationStream,
34    PresenceStream,
35    PushersStream,
36    PushRulesStream,
37    ReceiptsStream,
38    Stream,
39    TagAccountDataStream,
40    ToDeviceStream,
41    TypingStream,
42    UserSignatureStream,
43)
44from synapse.replication.tcp.streams.events import EventsStream
45from synapse.replication.tcp.streams.federation import FederationStream
46
47STREAMS_MAP = {
48    stream.NAME: stream
49    for stream in (
50        EventsStream,
51        BackfillStream,
52        PresenceStream,
53        PresenceFederationStream,
54        TypingStream,
55        ReceiptsStream,
56        PushRulesStream,
57        PushersStream,
58        CachesStream,
59        DeviceListsStream,
60        ToDeviceStream,
61        FederationStream,
62        TagAccountDataStream,
63        AccountDataStream,
64        GroupServerStream,
65        UserSignatureStream,
66    )
67}
68
69__all__ = [
70    "STREAMS_MAP",
71    "Stream",
72    "BackfillStream",
73    "PresenceStream",
74    "PresenceFederationStream",
75    "TypingStream",
76    "ReceiptsStream",
77    "PushRulesStream",
78    "PushersStream",
79    "CachesStream",
80    "DeviceListsStream",
81    "ToDeviceStream",
82    "TagAccountDataStream",
83    "AccountDataStream",
84    "GroupServerStream",
85    "UserSignatureStream",
86]
87