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/sqlite.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/sqlite.py')
-rw-r--r-- | synapse/storage/engines/sqlite.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/synapse/storage/engines/sqlite.py b/synapse/storage/engines/sqlite.py index 641e490697..2bfeefd54e 100644 --- a/synapse/storage/engines/sqlite.py +++ b/synapse/storage/engines/sqlite.py @@ -12,16 +12,16 @@ # 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. - +import sqlite3 import struct import threading +from synapse.storage.engines import BaseDatabaseEngine -class Sqlite3Engine(object): - single_threaded = True +class Sqlite3Engine(BaseDatabaseEngine[sqlite3.Connection]): def __init__(self, database_module, database_config): - self.module = database_module + super().__init__(database_module, database_config) database = database_config.get("args", {}).get("database") self._is_in_memory = database in (None, ":memory:",) @@ -32,6 +32,10 @@ class Sqlite3Engine(object): self._current_state_group_id_lock = threading.Lock() @property + def single_threaded(self) -> bool: + return True + + @property def can_native_upsert(self): """ Do we support native UPSERTs? This requires SQLite3 3.24+, plus some @@ -68,7 +72,6 @@ class Sqlite3Engine(object): return sql def on_new_connection(self, db_conn): - # We need to import here to avoid an import loop. from synapse.storage.prepare_database import prepare_database |