mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-15 10:53:09 -06:00
Refine docs
Signed-off-by: Alex Chen <minecnly@gmail.com>
This commit is contained in:
parent
19f1a6fe0d
commit
530ed11ecc
|
|
@ -62,8 +62,8 @@ func NewNotifier(pos types.SyncPosition) *Notifier {
|
|||
// Can be called with one among: a *gomatrixserverlib.Event, a room ID, or a list of user IDs.
|
||||
// posUpdate contains the latest position(s) for one or more types of events.
|
||||
// If a position in posUpdate is 0, it means no updates available of that type.
|
||||
// Typically a consumer supplies a posUpdate with and only with the sync position
|
||||
// for the type of event it handles to the latest.
|
||||
// Typically a consumer supplies a posUpdate with the sync position for the
|
||||
// event type it handles set to the latest, leaving other fields as 0.
|
||||
func (n *Notifier) OnNewEvent(ev *gomatrixserverlib.Event, roomID string, userIDs []string, posUpdate types.SyncPosition) {
|
||||
// update the current position then notify relevant /sync streams.
|
||||
// This needs to be done PRIOR to waking up users as they will read this value.
|
||||
|
|
|
|||
|
|
@ -76,9 +76,9 @@ func getTimeout(timeoutMS string) time.Duration {
|
|||
|
||||
// getSyncStreamPosition tries to parse a 'since' token taken from the API to a
|
||||
// stream position. If the string is empty then (nil, nil) is returned.
|
||||
// There are two types of token: The first is a full length one containing
|
||||
// all PDU and EDU positions. The second only contains the PDU position; prev_batch
|
||||
// tokens generated by the server will be in this form.
|
||||
// There are two forms of tokens: The full length form containing all PDU and EDU
|
||||
// positions separated by "_", and the short form containing only the PDU
|
||||
// position. Short form can be used for, e.g., `prev_batch` tokens.
|
||||
func getSyncStreamPosition(since string) (*types.SyncPosition, error) {
|
||||
if since == "" {
|
||||
return nil, nil
|
||||
|
|
|
|||
|
|
@ -42,7 +42,8 @@ func (sp SyncPosition) IsAfter(other SyncPosition) bool {
|
|||
}
|
||||
|
||||
// WithUpdates returns a copy of `sp` with updates represented by `other` applied.
|
||||
// If a field is not 0 in `other`, it is considered an update.
|
||||
// If a field is not 0 in `other`, it is considered an update and its value
|
||||
// will replace the corresponding value in sp.
|
||||
func (sp SyncPosition) WithUpdates(other SyncPosition) SyncPosition {
|
||||
ret := sp
|
||||
if other.PDUPosition != 0 {
|
||||
|
|
|
|||
Loading…
Reference in a new issue