summary refs log tree commit diff
path: root/synapse/state.py (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Refactor state moduleErik Johnston2018-08-091-866/+0
| | | | | We split out the actual state resolution algorithm to prepare for having multiple versions.
* Python 3: Convert some unicode/bytes uses (#3569)Amber Brown2018-08-021-1/+1
|
* Fixes and optimisations for resolve_state_groupsRichard van der Hoff2018-07-231-54/+89
| | | | | | | | | | | | | | | | | | | | First of all, fix the logic which looks for identical input state groups so that we actually use them. This turned out to be most easily done by factoring the relevant code out to a separate function so that we could do an early return. Secondly, avoid building the whole `conflicted_state` dict (which was only ever used as a boolean flag). Thirdly, replace the construction of the `state` dict (which mapped from keys to events that set them), with an optimistic construction of the resolution result assuming there will be no conflicts. This should be no slower than building the old `state` dict, and: - in the conflicted case, we'll short-cut it, saving part of the work - in the unconflicted case, it saves rebuilding the resolution from the `state` dict. Finally, do a couple of s/values/itervalues/.
* Make EventContext lazy load stateErik Johnston2018-07-231-3/+3
|
* Refcator EventContext to accept state during initErik Johnston2018-07-231-42/+55
|
* Make the rest of the .iterwhatever go away (#3562)Amber Brown2018-07-211-3/+3
|
* run isortAmber Brown2018-07-091-11/+11
|
* fix idiotic typo in state resMatthew Hodgson2018-06-111-2/+2
|
* Consistently use six's iteritems and wrap lazy keys/values in list() if ↵Amber Brown2018-05-311-1/+2
| | | | they're not meant to be lazy (#3307)
* py3-ize state.pyAdrian Tschira2018-05-241-23/+25
|
* Measure time it takes to calculate state group IDErik Johnston2018-03-281-27/+28
|
* Fix s/iteriterms/itervaluesErik Johnston2018-03-221-1/+1
|
* Use .iter* to avoid copies in StateHandlerErik Johnston2018-03-151-12/+12
|
* Merge pull request #2864 from matrix-org/rav/persist_event_cachingRichard van der Hoff2018-02-131-4/+30
|\ | | | | Use StateResolutionHandler to resolve state in persist_events
| * Add event_map param to resolve_state_groupsRichard van der Hoff2018-02-051-4/+30
| |
* | Store state groups separately from events (#2784)Erik Johnston2018-02-061-7/+49
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Split state group persist into seperate storage func * Add per database engine code for state group id gen * Move store_state_group to StateReadStore This allows other workers to use it, and so resolve state. * Hook up store_state_group * Fix tests * Rename _store_mult_state_groups_txn * Rename StateGroupReadStore * Remove redundant _have_persisted_state_group_txn * Update comments * Comment compute_event_context * Set start val for state_group_id_seq ... otherwise we try to recreate old state groups * Update comments * Don't store state for outliers * Update comment * Update docstring as state groups are ints
* Merge pull request #2842 from matrix-org/rav/state_resolution_handlerRichard van der Hoff2018-02-021-58/+103
|\ | | | | Factor out resolve_state_groups to a separate handler
| * Factor out resolve_state_groups to a separate handlerRichard van der Hoff2018-02-011-52/+97
| | | | | | | | | | | | We extract the storage-independent bits of the state group resolution out to a separate functiom, and stick it in a new handler, in preparation for its use from the storage layer.
| * Rename resolve_state_groups -> resolve_state_groups_for_eventsRichard van der Hoff2018-02-011-6/+6
| | | | | | | | (to make way for a method that actually just does the state group resolution)
* | Merge pull request #2836 from matrix-org/rav/resolve_state_events_docstringRichard van der Hoff2018-02-021-8/+28
|\ \ | |/ |/| Docstring fixes
| * doc arg types for _seperateRichard van der Hoff2018-02-011-0/+15
| |
| * More docstring fixesRichard van der Hoff2018-02-011-4/+4
| | | | | | | | Fix a couple of errors in docstrings
| * Fix docstring for StateHandler.resolve_state_groupsRichard van der Hoff2018-02-011-4/+9
| | | | | | | | The return type was a complete lie, so fix it
* | docstring for get_current_state_idsRichard van der Hoff2018-01-291-0/+13
| |
* | Remove unused "event_type" param on state.get_current_state_idsRichard van der Hoff2018-01-291-6/+1
|/ | | | | | this param doesn't seem to be used, and is a bit pointless anyway because it can easily be replicated by the caller. It is also horrible, because it changes the return type of the method.
* Split resolve_events into two functionsRichard van der Hoff2018-01-171-18/+27
| | | | ... so that the return type doesn't depend on the arg types
* replace 'except:' with 'except Exception:'Richard van der Hoff2017-10-231-1/+1
| | | | what could possibly go wrong
* some comments in the state res codeRichard van der Hoff2017-10-051-0/+13
|
* Define CACHE_SIZE_FACTOR onceErik Johnston2017-07-041-4/+1
|
* Change is_host_joined to use current_state tableErik Johnston2017-06-091-11/+0
| | | | | | This bypasses a bug where using the state groups to figure out if a host is in a room sometimes errors if the servers isn't in the room. (For example when the server rejected an invite to a remote room)
* Ensure we don't use unpersisted state group as prev groupErik Johnston2017-06-081-7/+6
|
* Merge branch 'develop' of github.com:matrix-org/synapse into erikj/state_fixupErik Johnston2017-06-071-0/+11
|\
| * Handle the server leaving a public roomErik Johnston2017-05-311-0/+11
| |
* | Remove spurious log linesErik Johnston2017-06-071-2/+0
| |
* | Handle None state group correctlyErik Johnston2017-05-261-3/+3
| |
* | Faster cache for get_joined_hostsErik Johnston2017-05-251-8/+8
| |
* | Don't return weird prev_groupErik Johnston2017-05-251-8/+13
| |
* | Remove unused optionsErik Johnston2017-05-251-11/+4
|/
* Fix comment and num argsErik Johnston2017-05-041-1/+1
|
* Add cache for get_current_hosts_in_roomErik Johnston2017-05-021-0/+11
|
* Merge pull request #1849 from matrix-org/erikj/state_typoErik Johnston2017-03-291-3/+3
|\ | | | | Fix bug where current_state_events renamed to current_state_ids
| * Fix bug where current_state_events renamed to current_state_idsErik Johnston2017-01-231-3/+3
| |
* | Refactoring and cleanupsRichard van der Hoff2017-03-171-8/+3
|/ | | | | | | | | | | | A few non-functional changes: * A bunch of docstrings to document types * Split `EventsStore._persist_events_txn` up a bit. Hopefully it's a bit more readable. * Rephrase `EventFederationStore._update_min_depth_for_room_txn` to avoid mind-bending conditional. * Rephrase rejected/outlier conditional in `_update_outliers_txn` to avoid mind-bending conditional.
* Derive current_state_events from state groupsErik Johnston2017-01-201-0/+3
|
* Merge pull request #1822 from matrix-org/erikj/statE_loggingErik Johnston2017-01-181-4/+4
|\ | | | | Change resolve_state_groups call site logging to DEBUG
| * Change resolve_state_groups call site logging to DEBUGErik Johnston2017-01-171-4/+4
| |
* | Merge pull request #1818 from matrix-org/erikj/state_auth_splitout_splitErik Johnston2017-01-181-60/+165
|\ \ | |/ |/| Optimise state resolution
| * PEP8Erik Johnston2017-01-171-1/+1
| |
| * Only construct sets when necessaryMark Haines2017-01-171-14/+19
| |
| * Use better namesErik Johnston2017-01-171-9/+7
| |
| * Correctly handle case of rejected events in state resErik Johnston2017-01-171-10/+16
| |
| * Check event is in state_mapErik Johnston2017-01-171-2/+7
| |
| * Optimise state resolutionErik Johnston2017-01-171-59/+150
| |
* | Merge pull request #1812 from matrix-org/erikj/state_auth_splitout_splitErik Johnston2017-01-171-138/+140
|\| | | | | Split out static state methods from StateHandler
| * Put staticmethods at module levelErik Johnston2017-01-161-123/+121
| |
| * Split out static state methods from StateHandlerErik Johnston2017-01-131-70/+74
| |
* | Up cache max entries for stateErik Johnston2017-01-161-1/+1
| |
* | Add support for 'iterable' to ExpiringCacheErik Johnston2017-01-161-1/+5
|/
* Name linearizer's for better logsErik Johnston2017-01-091-1/+1
|
* move logging to right placeMatthew Hodgson2017-01-071-1/+1
|
* Fix flake8 and update changelog v0.18.6-rc3Mark Haines2017-01-051-4/+4
|
* add logging for all the places we call resolve_state_groups. my kingdom for ↵Matthew Hodgson2017-01-051-0/+4
| | | | a backtrace that actually works.
* Merge pull request #1121 from matrix-org/erikj/public_room_paginateErik Johnston2016-09-151-2/+3
|\ | | | | Add pagination support to publicRooms
| * Refactor public rooms to not pull out the full state for each roomErik Johnston2016-09-141-2/+3
| |
* | Amalgamate two identical consecutive if statementsErik Johnston2016-09-141-7/+5
| |
* | Ensure we don't mutate state cache entriesErik Johnston2016-09-141-2/+4
|/
* Merge branch 'develop' of github.com:matrix-org/synapse into erikj/state_storageErik Johnston2016-09-021-71/+73
|\
| * Linearize state resolution to help cachesErik Johnston2016-09-011-56/+59
| |
* | Move to storing state_groups_state as deltasErik Johnston2016-09-011-2/+32
|/
* Handle the fact that workers can't generate state groupsErik Johnston2016-08-311-25/+56
|
* Always specify state_group so that its in the cacheErik Johnston2016-08-311-0/+2
|
* Correctly handle the difference between prev and current stateErik Johnston2016-08-311-8/+23
|
* Generate state group ids in state layerErik Johnston2016-08-311-3/+6
|
* Use state handler instead of get_users_in_room/get_joined_hostsErik Johnston2016-08-261-0/+9
|
* Pull out full state lessErik Johnston2016-08-251-4/+8
|
* Replace context.current_state with context.current_state_idsErik Johnston2016-08-251-21/+27
|
* Pull out event ids rather than full events for stateErik Johnston2016-08-251-38/+61
|
* CommentErik Johnston2016-07-151-0/+2
|
* Check sender signed eventErik Johnston2016-07-141-2/+2
|
* Always use state cache entry if it existsErik Johnston2016-04-201-3/+10
| | | | Also check if the resolved state matches an existing state group.
* Add some logging to state resolve_eventsErik Johnston2016-04-201-0/+5
|
* Merge pull request #689 from matrix-org/erikj/memberErik Johnston2016-04-041-3/+5
|\ | | | | Do checks for memberships before creating events
| * Do checks for memberships before creating eventsErik Johnston2016-04-011-3/+5
| |
* | Merge pull request #686 from matrix-org/markjh/doc_stringsMark Haines2016-04-011-8/+11
|\ \ | |/ |/| Use google style doc strings.
| * Use google style doc strings.Mark Haines2016-04-011-8/+11
| | | | | | | | | | | | | | pycharm supports them so there is no need to use the other format. Might as well convert the existing strings to reduce the risk of people accidentally cargo culting the wrong doc string format.
* | Remove outlier parameter from compute_event_contextMark Haines2016-03-311-2/+2
|/ | | | Use event.internal_metadata.is_outlier instead.
* Reduce cache sizeErik Johnston2016-03-231-1/+1
|
* Key StateHandler._state_cache off of state groupsErik Johnston2016-03-221-40/+21
|
* Make StateHandler._state_cache only store event_ids.Erik Johnston2016-03-221-7/+17
|
* Measure StateHandler._resolve_eventsErik Johnston2016-03-221-38/+40
|
* Fix flake8 warnings for new flake8Daniel Wagner-Hall2016-02-021-1/+1
|
* copyrightsMatthew Hodgson2016-01-071-1/+1
|
* Update some commentsRichard van der Hoff2015-11-131-4/+12
| | | | | | | Add a couple of type annotations, docstrings, and other comments, in the interest of keeping track of what types I have. Merged from pull request #370.
* Fix an issue with ignoring power_level changes on divergent graphsRichard van der Hoff2015-11-121-5/+11
| | | | | | | | Changes to m.room.power_levels events are supposed to be handled at a high priority; however a typo meant that the relevant bit of code was never executed, so they were handled just like any other state change - which meant that a bad person could cause room state changes by forking the graph from a point in history when they were allowed to do so.
* synapse/state.py:_get_state_key_from_event was unusedMark Haines2015-09-231-4/+0
|
* Remove run_on_reactorErik Johnston2015-09-171-3/+0
|
* Move all the caches into their own package, synapse.util.cachesErik Johnston2015-08-111-1/+1
|
* Use dictionary cache to do group -> state fetchingErik Johnston2015-08-051-5/+5
|
* Merge pull request #180 from matrix-org/erikj/prev_state_contextErik Johnston2015-06-031-4/+0
|\ | | | | Don't needlessly compute prev_state
| * Don't needlessly compute prev_stateErik Johnston2015-06-031-4/+0
| |
* | CommentErik Johnston2015-06-031-0/+3
| |
* | Don't needlessly compute contextErik Johnston2015-06-031-2/+13
|/
* Split a storage function in two so that we don't have to do extra work.Erik Johnston2015-05-011-6/+1
|
* Remove concept of context.auth_events, instead use context.current_stateErik Johnston2015-03-161-17/+0
|
* Make context.auth_events grap auth events from current state. Otherwise auth ↵Erik Johnston2015-03-161-17/+5
| | | | is wrong.
* Factor out ExpiringCache from StateHandlerErik Johnston2015-02-161-37/+9
|
* When we see a difference in current state, actually use state conflict ↵Erik Johnston2015-02-131-14/+29
| | | | resolution algorithm
* Remove unnecessary loggingErik Johnston2015-02-101-6/+1
|
* Merge branch 'develop' of github.com:matrix-org/synapse into state-chacheErik Johnston2015-02-101-1/+1
|\ | | | | | | | | | | Conflicts: synapse/app/homeserver.py synapse/state.py
| * During room intial sync, only calculate current state once.Erik Johnston2015-02-091-1/+1
| |
* | Oops, we do want to defer.return regardless of whether we are caching or notErik Johnston2015-02-101-1/+1
| |
* | Move construction of object within if blockErik Johnston2015-02-101-6/+6
| |
* | Bug fixes.Erik Johnston2015-02-061-27/+55
| |
* | Bugfix cache layerErik Johnston2015-02-061-10/+21
| |
* | Add cache layer to state group resolutionErik Johnston2015-02-061-0/+63
|/
* Change context.auth_events to what the auth_events would be bases on ↵Erik Johnston2015-02-041-2/+6
| | | | context.current_state, rather than based on the auth_events from the event.
* Fix state resolution to remember join_rules is a type of auth event.Erik Johnston2015-02-041-1/+13
|
* Remove debug loggingErik Johnston2015-01-301-9/+0
|
* Merge branch 'develop' of github.com:matrix-org/synapse into rejectionsErik Johnston2015-01-301-1/+2
|\ | | | | | | | | Conflicts: synapse/storage/schema/im.sql
| * Add a slightly more helpful commentErik Johnston2015-01-301-1/+2
| |
* | Merge branch 'replication_split' of github.com:matrix-org/synapse into ↵Erik Johnston2015-01-301-3/+5
|\| | | | | | | | | | | | | rejections Conflicts: synapse/storage/schema/delta/v12.sql
| * Remove commented lineErik Johnston2015-01-301-1/+0
| |
| * Style changes.Erik Johnston2015-01-301-6/+5
| |
* | Fix bug where we superfluously asked for current state. Change API of ↵Erik Johnston2015-01-301-4/+16
|/ | | | /query_auth/ so that we don't duplicate events in the response.
* fix pyflakesErik Johnston2015-01-221-1/+1
|
* Remove unused function. Add comment.Erik Johnston2015-01-211-16/+12
|
* Implement new state resolution algorithmErik Johnston2015-01-211-32/+71
|
* Update copyright noticesMark Haines2015-01-061-1/+1
|
* Merge branch 'release-v0.6.0' into developMark Haines2014-12-161-3/+4
|\
| * Fix typo where we thought a list was a dictErik Johnston2014-12-161-3/+4
| |
* | Construct the EventContext in the state handler rather than constructing one ↵Mark Haines2014-12-161-4/+10
| | | | | | | | and then immediately calling state_handler.annotate_context_with_state
* | Remove annotate_event_with_state as nothing was using it. Update state tests ↵Mark Haines2014-12-161-66/+0
|/ | | | to call annotate_context_with_state
* Better english in docstrings are helpful.Erik Johnston2014-12-161-2/+2
|
* Add basic docstring to annotate_context_with_stateErik Johnston2014-12-161-0/+11
|
* Kill off synapse.api.events.*Erik Johnston2014-12-161-2/+2
|
* Fix public room joining by making sure replaces_state never points to itself.Erik Johnston2014-12-111-1/+2
|
* Fix redactions. Fix 'age' keyErik Johnston2014-12-111-0/+12
|
* Try and figure out how and why signatures are being changed.Erik Johnston2014-12-101-0/+11
|
* Fix joining from an inviteErik Johnston2014-12-091-1/+3
|
* More bug fixesErik Johnston2014-12-081-2/+2
|
* More bug fixesErik Johnston2014-12-081-2/+6
|
* Various typos and bug fixes.Erik Johnston2014-12-081-4/+12
|
* Start making more things use EventContext rather than event.*Erik Johnston2014-12-051-0/+33
|
* Begin converting things to use the new Event structureErik Johnston2014-12-041-4/+14
|
* Correctly handle the case where we get an event for an unknown room, which ↵Erik Johnston2014-11-261-1/+1
| | | | turns out we are actually in
* synapse.state docs.Erik Johnston2014-11-111-0/+35
|
* Rename annotate_state_groups to annotate_event_with_stateErik Johnston2014-11-111-1/+1
|
* Fix bugs which broke federation due to changes in function signatures.Erik Johnston2014-11-111-1/+1
|
* Fix bug where we /always/ created a new state groupErik Johnston2014-11-111-23/+38
|
* Don't query the DB for user power levelsErik Johnston2014-11-071-10/+16
|
* Implement new replace_state and changed prev_stateErik Johnston2014-11-061-35/+4
| | | | | `prev_state` is now a list of previous state ids, similiar to prev_events. `replace_state` now points to what we think was replaced.
* Fix auth checks to all use the given old_event_stateErik Johnston2014-11-051-2/+6
|
* Remove unused importsErik Johnston2014-11-041-2/+0
|
* Remove dead code.Erik Johnston2014-11-031-84/+0
|
* Remove more references to dead PDU tablesErik Johnston2014-10-311-17/+6
|
* Remove unused functions.Erik Johnston2014-10-311-90/+0
|
* old_state_events should be a dict not listErik Johnston2014-10-311-2/+4
|
* Convert event ids to be of the form :example.comErik Johnston2014-10-301-5/+12
|
* Make federation return the old current state, so that we can use it to do authErik Johnston2014-10-301-5/+9
|
* Start filling out and using new events tablesErik Johnston2014-10-291-5/+6
|
* Remove duplicate importErik Johnston2014-10-271-1/+0
|
* Merge branch 'event_signing' of github.com:matrix-org/synapse into ↵Erik Johnston2014-10-271-4/+0
|\ | | | | | | | | | | | | federation_authorization Conflicts: synapse/storage/__init__.py
| * Include hashes of previous pdus when referencing themMark Haines2014-10-161-4/+0
| |
* | Fix bug where people could join private roomsErik Johnston2014-10-171-4/+8
| |
* | Use state groups to get current state. Make join dance actually work.Erik Johnston2014-10-171-25/+61
| |
* | Finish implementing the new join dance.Erik Johnston2014-10-171-2/+8
| |
* | Begin making auth use event.old_state_eventsErik Johnston2014-10-151-11/+7
| |
* | Begin implementing state groups.Erik Johnston2014-10-141-2/+85
|/
* Make the state resolution use actual power levels rather than taking them ↵Erik Johnston2014-09-121-11/+35
| | | | from a Pdu key.
* Handle the case where we don't have a common ancestorErik Johnston2014-09-081-9/+18
|
* Fix bug in state handling where we incorrectly identified a missing pdu. ↵Erik Johnston2014-09-081-49/+43
| | | | Update tests to catch this case.
* Fix bug where we used an event_id as a pdu_idErik Johnston2014-09-061-3/+5
|
* fix the copyright holder from matrix.org to OpenMarket Ltd, as matrix.org ↵Matthew Hodgson2014-09-031-1/+1
| | | | hasn't been incorporated in time for launch.
* Handle new state events which don't have a common ancestorErik Johnston2014-09-031-0/+12
|
* Start updating state handling to use snapshotsMark Haines2014-08-271-15/+3
|
* Rename method name to not clash with other ones in storage.Erik Johnston2014-08-151-1/+1
|
* Add a check to make sure that during state conflict res we only request a ↵Erik Johnston2014-08-151-2/+10
| | | | PDU we don't have.
* Fix pontenial bug in state resolution handler that compared dicts rather ↵Erik Johnston2014-08-151-1/+4
| | | | than their id's
* add in whitespace after copyright statements to improve legibilityMatthew Hodgson2014-08-131-0/+1
|
* Reference Matrix Home Servermatrix.org2014-08-121-0/+223