summary refs log tree commit diff
path: root/synapse/storage/engines/_base.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2020-10-07 17:09:29 +0100
committerErik Johnston <erik@matrix.org>2020-10-07 17:09:29 +0100
commit4b43332131bd0cc96dc5e806cc69236a39ce72f5 (patch)
treec7e5991a890ccc623f5d3e0318873e91821f817a /synapse/storage/engines/_base.py
parentMerge remote-tracking branch 'origin/release-v1.21.0' into matrix-org-hotfixes (diff)
parentReduce serialization errors in MultiWriterIdGen (#8456) (diff)
downloadsynapse-4b43332131bd0cc96dc5e806cc69236a39ce72f5.tar.xz
Merge remote-tracking branch 'origin/release-v1.21.0' into matrix-org-hotfixes
Diffstat (limited to 'synapse/storage/engines/_base.py')
-rw-r--r--synapse/storage/engines/_base.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/synapse/storage/engines/_base.py b/synapse/storage/engines/_base.py

index 908cbc79e3..d6d632dc10 100644 --- a/synapse/storage/engines/_base.py +++ b/synapse/storage/engines/_base.py
@@ -97,3 +97,20 @@ class BaseDatabaseEngine(Generic[ConnectionType], metaclass=abc.ABCMeta): """Gets a string giving the server version. For example: '3.22.0' """ ... + + @abc.abstractmethod + def in_transaction(self, conn: Connection) -> bool: + """Whether the connection is currently in a transaction. + """ + ... + + @abc.abstractmethod + def attempt_to_set_autocommit(self, conn: Connection, autocommit: bool): + """Attempt to set the connections autocommit mode. + + When True queries are run outside of transactions. + + Note: This has no effect on SQLite3, so callers still need to + commit/rollback the connections. + """ + ...