diff options
author | Richard van der Hoff <1389908+richvdh@users.noreply.github.com> | 2020-02-27 11:53:40 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-27 11:53:40 +0000 |
commit | 132b673dbefa42eb7669a11522426f26e225ac05 (patch) | |
tree | 418e03f3fdd23bf2f6781010daa4e6c0fc7ba49a /synapse/storage/engines/postgres.py | |
parent | Store room version on invite (#6983) (diff) | |
download | synapse-132b673dbefa42eb7669a11522426f26e225ac05.tar.xz |
Add some type annotations in `synapse.storage` (#6987)
I cracked, and added some type definitions in synapse.storage.
Diffstat (limited to 'synapse/storage/engines/postgres.py')
-rw-r--r-- | synapse/storage/engines/postgres.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/synapse/storage/engines/postgres.py b/synapse/storage/engines/postgres.py index 53b3f372b0..6c7d08a6f2 100644 --- a/synapse/storage/engines/postgres.py +++ b/synapse/storage/engines/postgres.py @@ -15,16 +15,14 @@ import logging -from ._base import IncorrectDatabaseSetup +from ._base import BaseDatabaseEngine, IncorrectDatabaseSetup logger = logging.getLogger(__name__) -class PostgresEngine(object): - single_threaded = False - +class PostgresEngine(BaseDatabaseEngine): def __init__(self, database_module, database_config): - self.module = database_module + super().__init__(database_module, database_config) self.module.extensions.register_type(self.module.extensions.UNICODE) # Disables passing `bytes` to txn.execute, c.f. #6186. If you do @@ -36,6 +34,10 @@ class PostgresEngine(object): self.synchronous_commit = database_config.get("synchronous_commit", True) self._version = None # unknown as yet + @property + def single_threaded(self) -> bool: + return False + def check_database(self, db_conn, allow_outdated_version: bool = False): # Get the version of PostgreSQL that we're using. As per the psycopg2 # docs: The number is formed by converting the major, minor, and |