This repository has been archived by the owner on Apr 26, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Attempt to annotate events_forward_extremities #11314
Merged
DMRobertson
merged 5 commits into
develop
from
dmr/typing/storage/events_forward_extermities
Nov 12, 2021
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
2f57fb1
Make DataStore inherit from EventForwardExtremitiesStore before Cache…
ab01dad
Attempt to anntoate events_forward_extermities
2e88d0f
Changelog.misc
4144d36
Merge branch 'develop' into dmr/typing/storage/events_forward_extermi…
2fa2676
Merge branch 'develop' into dmr/typing/storage/events_forward_extermi…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Add type hints to storage classes. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any concerns this could introduce bugs? The only way I could see that happening is if we're shadowing methods, but I really hope we're not doing that unless it is a worker vs. non-worker version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was scared of doing this, but I'm scared of the storage classes as a whole.
This is a very reasonable question that I don't know how to answer easily.
EventFederationWorkerStore has the following methods. Those without notes aren't defined anywhere else.
get_auth_chain
get_auth_chain_ids
_get_auth_chain_ids_using_cover_index_txn
_get_auth_chain_ids_txn
get_auth_chain_difference
StateResolutionStore
and is defined onTestStateResolutionStore
. I think these are wrappers rather than storage mixins. (?)_get_auth_chain_difference_using_cover_index_txn
_get_auth_chain_difference_txn
get_oldest_event_ids_with_depth_in_room
get_insertion_event_backwards_extremities_in_room
get_max_depth_of
get_min_depth_of
get_prev_events_for_room
_get_prev_events_for_room_txn
_get_prev_events_for_room_txn
get_latest_event_ids_in_room
get_min_depth
_get_min_depth_interaction
get_forward_extremities_for_room_at_stream_ordering
_get_forward_extremeties_for_room
get_backfill_events
_get_backfill_events
get_missing_events
_get_missing_events
get_successor_events
_delete_old_forward_extrem_cache
insert_insertion_extremity
insert_received_event_to_staging
remove_received_event_from_staging
get_next_staged_event_id_for_room
get_next_staged_event_for_room
prune_staged_events_in_room
get_all_rooms_with_staged_incoming_events
_get_stats_for_federation_staging
So the only shadowing is by a wrapper rather than a mixin. I think this is safe? But I'm mainly relying on CI not to explode to be honest.
CacheInvalidationWorkerStore to follow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CacheInvalidationWorkerStore
has the following methods. Those without notes aren't defined elsewhere.get_all_updated_caches
process_replication_rows
defined onCacheInvalidationWorkerStore
DeviceInboxWorkerStore
EventsWorkerStore
PrescenceStore
ReceiptsWorkerStore
super()
class, so I think this will traverse the whole MRO. I don't know how we can enforce that though._process_event_stream_row
_invalidate_caches_for_event
invalidate_cache_and_stream
_invalidate_cache_and_stream
_invalidate_all_cache_and_stream
_invalidate_state_caches_and_stream
_send_invalidation_to_replication
get_cache_stream_token_for_writer
Given that every
process_replication_rows
implementation calls the superclass will be safe provided thatEventForwardExtremitiesStore
's MRO is consistent with that ofDataStore
and any other top-level Stores. If the latter was not the case, we'd get a big TypeError at import time when trying to define the DataStore type.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the thorough review! 👍 I agree with your assessment!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suspect we might need to do this again if I keep pulling in superclasses like this. Maybe there's some way to automate this process?