This repository was 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 all 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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_chainget_auth_chain_ids_get_auth_chain_ids_using_cover_index_txn_get_auth_chain_ids_txnget_auth_chain_differenceStateResolutionStoreand is defined onTestStateResolutionStore. I think these are wrappers rather than storage mixins. (?)_get_auth_chain_difference_using_cover_index_txn_get_auth_chain_difference_txnget_oldest_event_ids_with_depth_in_roomget_insertion_event_backwards_extremities_in_roomget_max_depth_ofget_min_depth_ofget_prev_events_for_room_get_prev_events_for_room_txn_get_prev_events_for_room_txnget_latest_event_ids_in_roomget_min_depth_get_min_depth_interactionget_forward_extremities_for_room_at_stream_ordering_get_forward_extremeties_for_roomget_backfill_events_get_backfill_eventsget_missing_events_get_missing_eventsget_successor_events_delete_old_forward_extrem_cacheinsert_insertion_extremityinsert_received_event_to_stagingremove_received_event_from_stagingget_next_staged_event_id_for_roomget_next_staged_event_for_roomprune_staged_events_in_roomget_all_rooms_with_staged_incoming_events_get_stats_for_federation_stagingSo 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.
CacheInvalidationWorkerStorehas the following methods. Those without notes aren't defined elsewhere.get_all_updated_cachesprocess_replication_rowsdefined onCacheInvalidationWorkerStoreDeviceInboxWorkerStoreEventsWorkerStorePrescenceStoreReceiptsWorkerStoresuper()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_eventinvalidate_cache_and_stream_invalidate_cache_and_stream_invalidate_all_cache_and_stream_invalidate_state_caches_and_stream_send_invalidation_to_replicationget_cache_stream_token_for_writerGiven that every
process_replication_rowsimplementation calls the superclass will be safe provided thatEventForwardExtremitiesStore's MRO is consistent with that ofDataStoreand 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?