mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2024-10-01 11:49:51 -04:00
add remaining memoryview changes
This commit is contained in:
parent
1afafb3497
commit
4b9d0cde97
@ -80,7 +80,7 @@ class KeyStore(SQLBaseStore):
|
|||||||
values={
|
values={
|
||||||
"from_server": from_server,
|
"from_server": from_server,
|
||||||
"ts_added_ms": time_now_ms,
|
"ts_added_ms": time_now_ms,
|
||||||
"tls_certificate": buffer(tls_certificate_bytes),
|
"tls_certificate": db_binary_type(tls_certificate_bytes),
|
||||||
},
|
},
|
||||||
desc="store_server_certificate",
|
desc="store_server_certificate",
|
||||||
)
|
)
|
||||||
@ -143,7 +143,7 @@ class KeyStore(SQLBaseStore):
|
|||||||
values={
|
values={
|
||||||
"from_server": from_server,
|
"from_server": from_server,
|
||||||
"ts_added_ms": time_now_ms,
|
"ts_added_ms": time_now_ms,
|
||||||
"verify_key": buffer(verify_key.encode()),
|
"verify_key": db_binary_type(verify_key.encode()),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
txn.call_after(
|
txn.call_after(
|
||||||
@ -180,7 +180,7 @@ class KeyStore(SQLBaseStore):
|
|||||||
"from_server": from_server,
|
"from_server": from_server,
|
||||||
"ts_added_ms": ts_now_ms,
|
"ts_added_ms": ts_now_ms,
|
||||||
"ts_valid_until_ms": ts_expires_ms,
|
"ts_valid_until_ms": ts_expires_ms,
|
||||||
"key_json": buffer(key_json_bytes),
|
"key_json": db_binary_type(key_json_bytes),
|
||||||
},
|
},
|
||||||
desc="store_server_keys_json",
|
desc="store_server_keys_json",
|
||||||
)
|
)
|
||||||
|
@ -17,6 +17,7 @@ from ._base import SQLBaseStore
|
|||||||
from synapse.util.caches.descriptors import cached
|
from synapse.util.caches.descriptors import cached
|
||||||
|
|
||||||
from twisted.internet import defer
|
from twisted.internet import defer
|
||||||
|
import six
|
||||||
|
|
||||||
from canonicaljson import encode_canonical_json
|
from canonicaljson import encode_canonical_json
|
||||||
|
|
||||||
@ -25,6 +26,13 @@ from collections import namedtuple
|
|||||||
import logging
|
import logging
|
||||||
import simplejson as json
|
import simplejson as json
|
||||||
|
|
||||||
|
# py2 sqlite has buffer hardcoded as only binary type, so we must use it,
|
||||||
|
# despite being deprecated and removed in favor of memoryview
|
||||||
|
if six.PY2:
|
||||||
|
db_binary_type = buffer
|
||||||
|
else:
|
||||||
|
db_binary_type = memoryview
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
@ -110,7 +118,7 @@ class TransactionStore(SQLBaseStore):
|
|||||||
"transaction_id": transaction_id,
|
"transaction_id": transaction_id,
|
||||||
"origin": origin,
|
"origin": origin,
|
||||||
"response_code": code,
|
"response_code": code,
|
||||||
"response_json": buffer(encode_canonical_json(response_dict)),
|
"response_json": db_binary_type(encode_canonical_json(response_dict)),
|
||||||
"ts": self._clock.time_msec(),
|
"ts": self._clock.time_msec(),
|
||||||
},
|
},
|
||||||
or_ignore=True,
|
or_ignore=True,
|
||||||
|
Loading…
Reference in New Issue
Block a user