mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-02 09:56:05 -04:00
Add some type annotations in synapse.storage
(#6987)
I cracked, and added some type definitions in synapse.storage.
This commit is contained in:
parent
3e99528f2b
commit
132b673dbe
8 changed files with 270 additions and 84 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue