Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
synapse
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Maunium
synapse
Commits
6d13bdec
Commit
6d13bdec
authored
6 years ago
by
Erik Johnston
Browse files
Options
Downloads
Patches
Plain Diff
Add docstrings from matrix-org-hotfixes
parent
7b8a157b
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
synapse/handlers/sync.py
+26
-7
26 additions, 7 deletions
synapse/handlers/sync.py
synapse/storage/stream.py
+19
-0
19 additions, 0 deletions
synapse/storage/stream.py
with
45 additions
and
7 deletions
synapse/handlers/sync.py
+
26
−
7
View file @
6d13bdec
...
@@ -1894,15 +1894,34 @@ def _calculate_state(
...
@@ -1894,15 +1894,34 @@ def _calculate_state(
class
SyncResultBuilder
(
object
):
class
SyncResultBuilder
(
object
):
"
Used to help build up a new SyncResult for a user
"
"""
Used to help build up a new SyncResult for a user
Attributes:
sync_config (SyncConfig)
full_state (bool)
since_token (StreamToken)
now_token (StreamToken)
joined_room_ids (list[str])
# The following mirror the fields in a sync response
presence (list)
account_data (list)
joined (list[JoinedSyncResult])
invited (list[InvitedSyncResult])
archived (list[ArchivedSyncResult])
device (list)
groups (GroupsSyncResult|None)
to_device (list)
"""
def
__init__
(
self
,
sync_config
,
full_state
,
since_token
,
now_token
,
def
__init__
(
self
,
sync_config
,
full_state
,
since_token
,
now_token
,
joined_room_ids
):
joined_room_ids
):
"""
"""
Args:
Args:
sync_config(SyncConfig)
sync_config (SyncConfig)
full_state(bool): The full_state flag as specified by user
full_state (bool): The full_state flag as specified by user
since_token(StreamToken): The token supplied by user, or None.
since_token (StreamToken): The token supplied by user, or None.
now_token(StreamToken): The token to sync up to.
now_token (StreamToken): The token to sync up to.
joined_room_ids (list[str]): List of rooms the user is joined to
"""
"""
self
.
sync_config
=
sync_config
self
.
sync_config
=
sync_config
self
.
full_state
=
full_state
self
.
full_state
=
full_state
...
@@ -1930,8 +1949,8 @@ class RoomSyncResultBuilder(object):
...
@@ -1930,8 +1949,8 @@ class RoomSyncResultBuilder(object):
Args:
Args:
room_id(str)
room_id(str)
rtype(str): One of `
"
joined
"
` or `
"
archived
"
`
rtype(str): One of `
"
joined
"
` or `
"
archived
"
`
events(list): List of events to include in the room
, (more events
events(list
[FrozenEvent]
): List of events to include in the room
may be added when generating result).
(more events
may be added when generating result).
newly_joined(bool): If the user has newly joined the room
newly_joined(bool): If the user has newly joined the room
full_state(bool): Whether the full state should be sent in result
full_state(bool): Whether the full state should be sent in result
since_token(StreamToken): Earliest point to return events from, or None
since_token(StreamToken): Earliest point to return events from, or None
...
...
This diff is collapsed.
Click to expand it.
synapse/storage/stream.py
+
19
−
0
View file @
6d13bdec
...
@@ -191,6 +191,25 @@ class StreamWorkerStore(EventsWorkerStore, SQLBaseStore):
...
@@ -191,6 +191,25 @@ class StreamWorkerStore(EventsWorkerStore, SQLBaseStore):
@defer.inlineCallbacks
@defer.inlineCallbacks
def
get_room_events_stream_for_rooms
(
self
,
room_ids
,
from_key
,
to_key
,
limit
=
0
,
def
get_room_events_stream_for_rooms
(
self
,
room_ids
,
from_key
,
to_key
,
limit
=
0
,
order
=
'
DESC
'
):
order
=
'
DESC
'
):
"""
Get new room events in stream ordering since `from_key`.
Args:
room_id (str)
from_key (str): Token from which no events are returned before
to_key (str): Token from which no events are returned after. (This
is typically the current stream token)
limit (int): Maximum number of events to return
order (str): Either
"
DESC
"
or
"
ASC
"
. Determines which events are
returned when the result is limited. If
"
DESC
"
then the most
recent `limit` events are returned, otherwise returns the
oldest `limit` events.
Returns:
Deferred[dict[str,tuple[list[FrozenEvent], str]]]
A map from room id to a tuple containing:
- list of recent events in the room
- stream ordering key for the start of the chunk of events returned.
"""
from_id
=
RoomStreamToken
.
parse_stream_token
(
from_key
).
stream
from_id
=
RoomStreamToken
.
parse_stream_token
(
from_key
).
stream
room_ids
=
yield
self
.
_events_stream_cache
.
get_entities_changed
(
room_ids
=
yield
self
.
_events_stream_cache
.
get_entities_changed
(
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment