Commit Graph

123 Commits

Author SHA1 Message Date
Erik Johnston
cee9445884
Better return type for get_all_entities_changed ()
Help callers from using the return value incorrectly by ensuring
that callers explicitly check if there was a cache hit or not.
2022-12-05 15:19:14 -05:00
Patrick Cloke
126a15794c
Do not allow a None-limit on PaginationConfig. ()
The callers either set a default limit or manually handle a None-limit
later on (by setting a default value).

Update the callers to always instantiate PaginationConfig with a default
limit and then assume the limit is non-None.
2022-10-14 12:30:05 +00:00
Mathieu Velten
41461fd4d6
typing: check origin server of typing event against room's servers ()
This is also using the partial state approximation if needed so we do
not block here during a fast join.

Signed-off-by: Mathieu Velten <mathieuv@matrix.org>
Co-authored-by: Sean Quah <8349537+squahtx@users.noreply.github.com>
2022-09-26 17:33:32 +02:00
reivilibre
c06b2b7142
Faster Remote Room Joins: tell remote homeservers that we are unable to authorise them if they query a room which has partial state on our server. () 2022-09-23 11:47:16 +01:00
Eric Eastwood
1a209efdb2
Update get_users_in_room mis-use to get hosts with dedicated get_current_hosts_in_room ()
See https://github.com/matrix-org/synapse/pull/13575#discussion_r953023755
2022-08-24 14:15:37 -05:00
Quentin Gliech
3dd175b628
synapse.api.auth.Auth cleanup: make permission-related methods use Requester instead of the UserID ()
Part of 

This changes all the permission-related methods to rely on the Requester instead of the UserID. This is a first step towards enabling scoped access tokens at some point, since I expect the Requester to have scope-related informations in it.

It also changes methods which figure out the user/device/appservice out of the access token to return a Requester instead of something else. This avoids having store-related objects in the methods signatures.
2022-08-22 14:17:59 +01:00
Nick Mills-Barrett
bf3115584c
Copy room serials before handling in get_new_events_as () 2022-07-26 17:45:27 +00:00
Erik Johnston
f721f1baba
Revert "Make all process_replication_rows methods async ()" ()
This reverts commit 5d4028f217.
2022-07-18 14:28:14 +01:00
Nick Mills-Barrett
5d4028f217
Make all process_replication_rows methods async ()
More prep work for asyncronous caching, also makes all process_replication_rows methods consistent (presence handler already is so).

Signed off by Nick @ Beeper (@Fizzadar)
2022-07-17 22:19:43 +01:00
Erik Johnston
44de53bb79
Reduce state pulled from DB due to sending typing and receipts over federation ()
Reducing the amount of state we pull from the DB is useful as fetching state is expensive in terms of DB, CPU and memory.
2022-06-06 16:46:11 +01:00
Patrick Cloke
c52abc1cfd
Additional constants for EDU types. ()
Instead of hard-coding strings in many places.
2022-05-27 07:14:36 -04:00
Andrew Morgan
83be72d76c
Add StreamKeyType class and replace string literals with constants () 2022-05-16 15:35:31 +00:00
reivilibre
4a53f35737
Improve code documentation for the typing stream over replication. () 2022-03-11 14:00:15 +00:00
Andrew Morgan
fb0ffa9676
Rename various ApplicationServices interested methods () 2022-03-03 18:14:09 +00:00
Richard van der Hoff
e24ff8ebe3
Remove HomeServer.get_datastore() ()
The presence of this method was confusing, and mostly present for backwards
compatibility. Let's get rid of it.

Part of 
2022-02-23 11:04:02 +00:00
Andrew Morgan
e03dde259b
Clean up an indirect reference to the homeserver datastore () 2022-02-07 13:25:09 +00:00
Patrick Cloke
cbd82d0b2d
Convert all namedtuples to attrs. ()
To improve type hints throughout the code.
2021-12-30 18:47:12 +00:00
Sean Quah
84fac0f814
Add type annotations to synapse.metrics () 2021-11-17 19:07:02 +00:00
Nick Barrett
af54167516
Enable passing typing stream writers as a list. ()
This makes the typing stream writer config match the other stream writers
that only currently support a single worker.
2021-11-03 14:25:47 +00:00
Andrew Morgan
6408372234
Improve docstrings for methods related to sending EDUs to application services () 2021-10-21 17:42:25 +01:00
Andrew Morgan
aa2c027792
Remove unnecessary parentheses around tuples returned from methods () 2021-09-23 11:59:07 +01:00
Patrick Cloke
4054dfa409
Add type hints for event streams. () 2021-09-21 13:34:26 -04:00
Patrick Cloke
b3590614da
Require type hints in the handlers module. ()
Adds missing type hints to methods in the synapse.handlers
module and requires all methods to have type hints there.

This also removes the unused construct_auth_difference method
from the FederationHandler.
2021-09-20 08:56:23 -04:00
Patrick Cloke
01c88a09cd
Use direct references for some configuration variables ()
Instead of proxying through the magic getter of the RootConfig
object. This should be more performant (and is more explicit).
2021-09-13 13:07:12 -04:00
reivilibre
524b8ead77
Add types to synapse.util. () 2021-09-10 17:03:18 +01:00
Dagfinn Ilmari Mannsåker
dc46f12725
Include room ID in ignored EDU log messages ()
Signed-off-by: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
2021-08-03 13:35:49 +00:00
Jonathan de Jong
98aec1cc9d
Use inline type hints in handlers/ and rest/. () 2021-07-16 18:22:36 +01:00
Dagfinn Ilmari Mannsåker
47e28b4031
Ignore EDUs for rooms we're not in () 2021-07-06 14:31:13 +01:00
Jonathan de Jong
4b965c862d
Remove redundant "coding: utf-8" lines ()
Part of 

Removes all redundant `# -*- coding: utf-8 -*-` lines from files, as python 3 automatically reads source code as utf-8 now.

`Signed-off-by: Jonathan de Jong <jonathan@automatia.nl>`
2021-04-14 15:34:27 +01:00
Erik Johnston
33548f37aa
Improve tracing for to device messages () 2021-04-01 17:08:21 +01:00
Eric Eastwood
0a00b7ff14
Update black, and run auto formatting over the codebase ()
- Update black version to the latest
 - Run black auto formatting over the codebase
    - Run autoformatting according to [`docs/code_style.md
`](80d6dc9783/docs/code_style.md)
 - Update `code_style.md` docs around installing black to use the correct version
2021-02-16 22:32:34 +00:00
Patrick Cloke
1baab20352
Add type hints to various handlers. ()
With this change all handlers except the e2e_* ones have
type hints enabled.
2021-01-26 10:50:21 -05:00
Erik Johnston
0c7f9cb81f
Don't unnecessarily start bg process while handling typing. ()
There's no point starting a background process when all its going to do is bail if federation isn't enabled.
2020-10-27 15:32:19 +00:00
Patrick Cloke
34a5696f93
Fix typos and spelling errors. () 2020-10-23 12:38:40 -04:00
Will Hunt
c276bd9969
Send some ephemeral events to appservices ()
Optionally sends typing, presence, and read receipt information to appservices.
2020-10-15 12:33:28 -04:00
Patrick Cloke
c619253db8
Stop sub-classing object () 2020-09-04 06:54:56 -04:00
Patrick Cloke
6fe12c9512
Do not propagate typing notifications from shadow-banned users. () 2020-08-26 12:05:36 -04:00
Erik Johnston
f2e38ca867
Allow moving typing off master () 2020-07-16 15:12:54 +01:00
Erik Johnston
62352c3a1b Fix typo 2020-07-15 15:46:16 +01:00
Erik Johnston
3a3a618460 Use get_users_in_room rather than state handler in typing for speed 2020-07-15 15:42:07 +01:00
Erik Johnston
67d7756fcf
Refactor getting replication updates from database v2. () 2020-07-07 12:11:35 +01:00
Patrick Cloke
3630825612
Convert the typing handler to async/await. () 2020-06-17 10:37:59 -04:00
Erik Johnston
f6f7511a4c
Refactor getting replication updates from database. ()
The aim here is to make it easier to reason about when streams are limited and when they're not, by moving the logic into the database functions themselves. This should mean we can kill of `db_query_to_update_function` function.
2020-06-16 17:10:28 +01:00
Erik Johnston
fdb1344716
Remove concept of a non-limited stream. () 2020-03-20 14:40:47 +00:00
Patrick Cloke
509e381afa
Clarify list/set/dict/tuple comprehensions and enforce via flake8 ()
Ensure good comprehension hygiene using flake8-comprehensions.
2020-02-21 07:15:07 -05:00
Richard van der Hoff
b58d17e44f Refactor the membership check methods in Auth
these were getting a bit unwieldy, so let's combine `check_joined_room` and
`check_user_was_in_room` into a single `check_user_in_room`.
2020-02-18 23:21:44 +00:00
Erik Johnston
48c3a96886
Port synapse.replication.tcp to async/await ()
* Port synapse.replication.tcp to async/await

* Newsfile

* Correctly document type of on_<FOO> functions as async

* Don't be overenthusiastic with the asyncing....
2020-01-16 09:16:12 +00:00
Erik Johnston
02553901ce
Remove unused get_pagination_rows methods. ()
Remove unused get_pagination_rows methods
2019-12-17 11:44:32 +00:00
Erik Johnston
b3a4e35ca8 Fixup functions to consistently return deferreds 2019-12-06 10:40:05 +00:00
Andrew Morgan
bc29a19731 Replace instance variations of homeserver with correct case/spacing 2019-11-12 13:08:12 +00:00