mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-02 13:56:02 -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
|
@ -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:",)
|
||||
|
@ -31,6 +31,10 @@ class Sqlite3Engine(object):
|
|||
self._current_state_group_id = None
|
||||
self._current_state_group_id_lock = threading.Lock()
|
||||
|
||||
@property
|
||||
def single_threaded(self) -> bool:
|
||||
return True
|
||||
|
||||
@property
|
||||
def can_native_upsert(self):
|
||||
"""
|
||||
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue