aboutsummaryrefslogtreecommitdiff
path: root/syncapi/sync
diff options
context:
space:
mode:
authorKegsay <kegan@matrix.org>2020-07-29 19:00:04 +0100
committerGitHub <noreply@github.com>2020-07-29 19:00:04 +0100
commit0fdd4f14d123e76bd3d0368947d3aab84a787946 (patch)
tree024b7d526095bfe2a64d46d1eba4ca4e0c3b388b /syncapi/sync
parent9a5fb489c5f80148a8512e61c95c8df7bb46d314 (diff)
Add support for logs in StreamingToken (#1229)
* Add support for logs in StreamingToken Tokens now end up looking like `s11_22|dl-0-123|ab-0-12224` where `dl` and `ab` are log names, `0` is the partition and `123` and `12224` are the offsets. * Also test reserialisation * s/|/./g so tokens url escape nicely
Diffstat (limited to 'syncapi/sync')
-rw-r--r--syncapi/sync/notifier_test.go10
-rw-r--r--syncapi/sync/request.go2
-rw-r--r--syncapi/sync/requestpool.go2
3 files changed, 7 insertions, 7 deletions
diff --git a/syncapi/sync/notifier_test.go b/syncapi/sync/notifier_test.go
index f2a368ec..5a4c7b31 100644
--- a/syncapi/sync/notifier_test.go
+++ b/syncapi/sync/notifier_test.go
@@ -32,11 +32,11 @@ var (
randomMessageEvent gomatrixserverlib.HeaderedEvent
aliceInviteBobEvent gomatrixserverlib.HeaderedEvent
bobLeaveEvent gomatrixserverlib.HeaderedEvent
- syncPositionVeryOld = types.NewStreamToken(5, 0)
- syncPositionBefore = types.NewStreamToken(11, 0)
- syncPositionAfter = types.NewStreamToken(12, 0)
- syncPositionNewEDU = types.NewStreamToken(syncPositionAfter.PDUPosition(), 1)
- syncPositionAfter2 = types.NewStreamToken(13, 0)
+ syncPositionVeryOld = types.NewStreamToken(5, 0, nil)
+ syncPositionBefore = types.NewStreamToken(11, 0, nil)
+ syncPositionAfter = types.NewStreamToken(12, 0, nil)
+ syncPositionNewEDU = types.NewStreamToken(syncPositionAfter.PDUPosition(), 1, nil)
+ syncPositionAfter2 = types.NewStreamToken(13, 0, nil)
)
var (
diff --git a/syncapi/sync/request.go b/syncapi/sync/request.go
index 41b18aa1..0996729e 100644
--- a/syncapi/sync/request.go
+++ b/syncapi/sync/request.go
@@ -65,7 +65,7 @@ func newSyncRequest(req *http.Request, device userapi.Device, syncDB storage.Dat
since = &tok
}
if since == nil {
- tok := types.NewStreamToken(0, 0)
+ tok := types.NewStreamToken(0, 0, nil)
since = &tok
}
timelineLimit := DefaultTimelineLimit
diff --git a/syncapi/sync/requestpool.go b/syncapi/sync/requestpool.go
index 196d446a..bf6a9e01 100644
--- a/syncapi/sync/requestpool.go
+++ b/syncapi/sync/requestpool.go
@@ -138,7 +138,7 @@ func (rp *RequestPool) OnIncomingSyncRequest(req *http.Request, device *userapi.
func (rp *RequestPool) currentSyncForUser(req syncRequest, latestPos types.StreamingToken) (res *types.Response, err error) {
res = types.NewResponse()
- since := types.NewStreamToken(0, 0)
+ since := types.NewStreamToken(0, 0, nil)
if req.since != nil {
since = *req.since
}