Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
use the ABC metaclass
Browse files Browse the repository at this point in the history
  • Loading branch information
richvdh committed Jan 7, 2020
1 parent cd64ddd commit b55eb5a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 3 additions & 1 deletion synapse/storage/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
# limitations under the License.
import logging
import random
from abc import ABCMeta

from six import PY2
from six.moves import builtins
Expand All @@ -30,7 +31,8 @@
logger = logging.getLogger(__name__)


class SQLBaseStore(object):
# some of our subclasses have abstract methods, so we use the ABCMeta metaclass.
class SQLBaseStore(metaclass=ABCMeta):
"""Base class for data stores that holds helper functions.
Note that multiple instances of this class will exist as there will be one
Expand Down
6 changes: 6 additions & 0 deletions synapse/storage/data_stores/main/room.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import collections
import logging
import re
from abc import abstractmethod
from typing import Optional, Tuple

from six import integer_types
Expand Down Expand Up @@ -499,7 +500,12 @@ def _get_rooms(txn):

return len(rooms)

@abstractmethod
def set_room_is_public(self, room_id, is_public):
# this will need to be implemented if a background update is performed with
# existing (tombstoned, public) rooms in the database.
#
# It's overridden by RoomStore for the synapse master.
raise NotImplementedError()


Expand Down

0 comments on commit b55eb5a

Please sign in to comment.